experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(shortcuts): surface globalShortcut.register failures (linux/wayland)

Two diagnostic improvements for the "shortcuts broken on Linux"
report. We can't repro on darwin, so this is groundwork: make the
next Linux-side investigation see exactly what's failing.

- `registerGlobalShortcut` now logs `requested`, the platform-
translated `accelerator`, and `process.platform` when
`globalShortcut.register` returns false. Wayland compositors
often refuse the grab silently — without the accelerator string
in the log it was hard to correlate with WM-reserved bindings
(e.g. `Alt+Space` in GNOME).
- `tile:shortcuts:register` now checks the return value of
`registerGlobalShortcut` and replies with the error on the
caller's `replyTopic`. Previously the error was dropped on the
floor and the caller assumed registration succeeded.

The local-shortcut fallback in `app/cmd/background.js` (registering
the same hotkey as both global and local) is unchanged. The
remaining "local shortcuts also broken on Linux" leg of the bug
needs hands-on Linux to triage — most likely candidates are the
WM/compositor swallowing the keypress before `before-input-event`
fires or a `process.platform` branch elsewhere; both require a
Linux Electron run to confirm.

+20 -3
+8 -2
backend/electron/shortcuts.ts
··· 191 191 }); 192 192 193 193 if (ret !== true) { 194 - console.error('registerGlobalShortcut FAILED:', shortcut); 195 - return new Error(`Failed to register shortcut: ${shortcut}`); 194 + // Common on Linux Wayland: globalShortcut.register returns false silently 195 + // when the compositor refuses to grab the key. Logging the platform- 196 + // translated accelerator (e.g. "Alt+Space" on Linux for "Option+Space") 197 + // makes it easier to correlate with WM-reserved bindings. 198 + console.error( 199 + `[shortcuts] globalShortcut.register FAILED: requested="${shortcut}" accelerator="${accelerator}" platform=${process.platform}` 200 + ); 201 + return new Error(`Failed to register shortcut: ${shortcut} (accelerator: ${accelerator})`); 196 202 } 197 203 198 204 globalShortcuts.set(shortcut, source);
+12 -1
backend/electron/tile-ipc.ts
··· 677 677 }; 678 678 679 679 if (isGlobal) { 680 - registerGlobalShortcut(args.shortcut, source, callback); 680 + // Surface registration errors back to the caller. Previously the return 681 + // value was dropped, so a failed global shortcut (common on Linux 682 + // Wayland — see `registerGlobalShortcut`) looked indistinguishable 683 + // from success to the renderer. 684 + const err = registerGlobalShortcut(args.shortcut, source, callback); 685 + if (err) { 686 + console.error( 687 + `[tile-ipc] tile:shortcuts:register global failed for tile=${activeGrant.tileId} shortcut="${args.shortcut}": ${err.message}` 688 + ); 689 + replyError(err.message); 690 + return; 691 + } 681 692 } else { 682 693 const modeConditions = modeStr ? { majorMode: modeStr as import('./datastore.js').MajorModeId } : undefined; 683 694 registerLocalShortcut(args.shortcut, source, callback, modeConditions);