"Track 3 wired one keyboard shortcut. Lesson 4 broadens the trigger set — multiple commands, the chrome://extensions/shortcuts re-binding page, and the omnibox keyword that turns Chrome's address bar into a ClipDeck search input. Power-user moves that take five lines of manifest each."
chrome.commands Recap
Track 3 Lesson 6 introduced commands.save-clip. The same mechanism scales to up to four user-bindable shortcuts per extension in the stable channel:
- Declare each command in
manifest.commandswith a unique key, asuggested_key, and adescription. - Listen with
chrome.commands.onCommand.addListener((name) => ...)in the SW. - Users can re-bind any of them via
chrome://extensions/shortcuts— Chrome surfaces every extension's commands there. - The special
_execute_actioncommand opens the popup;_execute_side_panelopens the panel without an SW listener.
Diagnosing What's Bound
chrome.commands.getAll() returns the current set with the active key for each. Useful in an onInstalled handler — log the commands so you know whether Chrome silently dropped your suggested key (it happens when another extension or Chrome itself already owns the combo):
const cmds = await chrome.commands.getAll();
for (const c of cmds) console.log(c.name, '→', c.shortcut || '(unbound)');
If shortcut is empty, the user (or the install conflict resolution) didn't bind anything. Surface a one-time hint in the onboarding popup so users can find the re-bind page.
The Omnibox API
chrome.omnibox turns Chrome's address bar into your extension's input. The user types a keyword (declared in the manifest), a space, then their query — your SW receives every keystroke and returns suggestions.
Three fields and three events:
- Manifest:
"omnibox": { "keyword": "clip" }. chrome.omnibox.onInputStarted— user just typed the keyword + space; fire one-time setup.chrome.omnibox.onInputChanged(text, suggest)— fired on every keystroke after the keyword. Callsuggest([{ content, description }])with up to ~5 entries.chrome.omnibox.onInputEntered(text, disposition)— user picked an entry or hit Enter.dispositiontells you whether they want a new tab, the current tab, etc.
For ClipDeck, the obvious play: type clip space in the address bar, then a search term; suggestions list matching clips by source title; selecting one opens the source URL in a new tab.
Discoverability of Omnibox
Omnibox is genuinely a power-user feature — most users will not discover it on their own. Surface it in:
- The popup help link ("Type
clipin the address bar to search saved clips"). - The options page (Track 6).
- A first-install onboarding tab if you ship one.
Don't over-engineer the omnibox UI — five suggestions, short titles, one detail line. The user picked their address bar for speed; preserve it.
The Trigger Ladder
ClipDeck now has the full ladder:
- Floating button on every page (Track 3 Lesson 4) — most discoverable, most intrusive.
- Keyboard shortcut Ctrl+Shift+K (Track 3 Lesson 6) — fastest for repeat users.
- Toolbar icon click → popup → Save (this track Lesson 2) — middle ground.
- Right-click selection → 'Save to ClipDeck' (this track Lesson 3) — in-the-moment discoverability.
- Omnibox
clip ...for search (this lesson) — power-user retrieval.
Each costs almost nothing to maintain. Together they cover every type of user — the power user, the kbd-shy clicker, the right-click person, the omnibox enthusiast. You ship them all because they each tax you a few lines of code and reach a different audience.