Menu ▾ ▴

#30 Add Caprine-style keyboard shortcuts (New Conversation, Search, Insert GIF/Emoji, Attach, Focus Input)

closed
nobody
2026-07-03
2026-06-30
Anonymous
No

Originally created by: kristofferR

Summary

Caprine exposes a set of keyboard shortcuts via its native menus that Carrier doesn't have. Add a chosen subset of them, page-side in inject/messenger.js (same place as the existing chatRows() jump shortcuts) — no Carrier custom commands needed.

Implementation principle: facebook.com/messages is a minified React SPA we don't control. There is no exposed JS command for most of these actions — the logic lives inside React's internal event handlers with no callable global. So prefer the cleanest mechanism per action:

  1. Direct JS where the action is genuinely a plain DOM op (focus an input, navigate a route). Preferred — no simulated click.
  2. Click the existing button where the action opens a React-driven picker/panel with no reachable handler. Robust fallback.
  3. Don't reach into the React fiber to call handlers — it breaks on every FB bundle reship.

Shortcuts to add

Action Key (mac / other) Mechanism Notes
Focus Text Input ⌘L / Ctrl+L direct JS composer.focus() — plain DOM op
New Conversation ⌘N / Ctrl+N direct JS (try) Navigate to the compose route if one exists; else click the "New message" button
Insert Emoji ⌘E / Ctrl+E click Opens a React picker — no callable global
Insert GIF ⌘G / Ctrl+G click Opens a React picker — no callable global
Attach Files ⌘T / Ctrl+T click Composer attach/upload button
Search in Conversation ⌘F / Ctrl+F click (two-step) Open the conversation info sidebar first, then click Search

Explicitly NOT included

These Caprine shortcuts are intentionally left out for now:

  • Mute Conversation (⇧⌘M), Archive Conversation (⇧⌘H), Delete Conversation (⇧⌘D)
  • Select Next / Previous Conversation (⌃Tab / ⌃⇧Tab) — Carrier already has Cmd/Ctrl+1–9 to jump to a conversation
  • Insert Sticker (⌘S)

Constraints

  • Don't touch existing shortcuts. Current accelerator bindings in inject/messenger.js: [ / ] (back/forward), - / = / + / 0 (zoom), r (reload), F2 / F3 / F5, and Cmd/Ctrl+1–9 (jump to Nth conversation). None of the new keys collide with these.
  • The new bindings overlap with some WebView/browser defaults (⌘N new window, ⌘F browser find, ⌘T new tab, ⌘G find-next). Carrier runs chrome-stripped so these should be free, but preventDefault() and verify there's no unwanted default behavior.
  • Reference: Caprine keyboard shortcuts.

Implementation notes

  • Add to the accelerator shortcuts map (or a parallel handler) in src-tauri/inject/messenger.js.
  • Each handler should query for the relevant Messenger button by a stable selector / aria-label and .click() / .focus() it; bail quietly if not found (FB markup changes).
  • Some actions aren't a single button — they require navigating the UI first:
  • Search in Conversation (⌘F): the search control only exists once the conversation info/profile sidebar is open. The handler must first open that sidebar (if closed), then click Search. The sidebar may render asynchronously, so click the target after it appears (poll / MutationObserver / requestAnimationFrame, don't assume it's there synchronously).
  • Audit each of the other actions for the same pattern — Insert GIF/Emoji and Attach may live behind a "more actions" (…) overflow on narrow widths. Open the parent control first, then click the target, and tolerate the button being absent.
  • Validate: node --check inject/messenger.js.

Related

Tickets: #18
Tickets: #42

Discussion

  • Anonymous

    Anonymous - 2026-07-03

    Ticket changed by: kristofferR

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-07-03

    Originally posted by: kristofferR

    Implemented in PR [#42], page-side in inject/messenger.js per the mechanism table: Cmd/Ctrl+L focuses the composer (plain focus()), Cmd/Ctrl+E / G open Messenger's emoji/GIF pickers, Cmd/Ctrl+T clicks the attach button, and Cmd/Ctrl+F does the two-step search (opens the conversation-info sidebar when closed, then clicks its Search control once rendered — the control's aria-label is just "Search"). New Conversation deviates from the table: the native File menu already claimed ⌘N for New Window, so compose shipped as a File-menu item on Cmd/Ctrl+Shift+N instead (maintainer call), clicking the a[href="/messages/new/"] control. All selectors were verified against the live Messenger DOM via a new sanitized mcp-bridge probe. Existing shortcuts untouched except Cmd/Ctrl+[ / ] which now step conversations per [#18], and Hide Names & Avatars which moved to Cmd/Ctrl+Shift+H.

     

    Related

    Tickets: #18
    Tickets: #42


Log in to post a comment.