mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-10 22:32:17 +02:00
fix: strip playback accelerators whenever any text input is focused (#2059)
The command-palette-specific IPC approach didn't cover other modals with inputs (settings search, playlist creation, etc.). Replace it with document-level focusin/focusout listeners that signal the main process whenever any input/textarea/contenteditable gains or loses focus, so the menu rebuild is triggered automatically for all current and future input surfaces. Co-authored-by: muckymucky <muckymucky@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-6
@@ -280,12 +280,12 @@ let currentRepeatMode: PlayerRepeat = PlayerRepeat.NONE;
|
||||
let currentSidebarCollapsed = false;
|
||||
let currentShuffleEnabled = false;
|
||||
let playbackMenuAccelerators: MenuPlaybackState['accelerators'] = {};
|
||||
let commandPaletteOpen = false;
|
||||
let inputFocused = false;
|
||||
|
||||
ipcMain.on('command-palette-state', (_event, opened: boolean) => {
|
||||
const next = !!opened;
|
||||
if (commandPaletteOpen === next) return;
|
||||
commandPaletteOpen = next;
|
||||
ipcMain.on('input-focus-state', (_event, focused: boolean) => {
|
||||
const next = !!focused;
|
||||
if (inputFocused === next) return;
|
||||
inputFocused = next;
|
||||
if (isMacOS()) {
|
||||
rebuildMainMenu();
|
||||
}
|
||||
@@ -350,7 +350,7 @@ const rebuildMainMenu = () => {
|
||||
if (!menuBuilder || !mainWindow) return;
|
||||
|
||||
menuBuilder.buildMenu({
|
||||
accelerators: commandPaletteOpen ? {} : playbackMenuAccelerators,
|
||||
accelerators: inputFocused ? {} : playbackMenuAccelerators,
|
||||
playbackStatus: currentPlaybackStatus,
|
||||
privateMode: currentPrivateMode,
|
||||
repeatMode: currentRepeatMode,
|
||||
|
||||
Reference in New Issue
Block a user