feat(shortcuts): action registry + dynamic CLI help + new input targets (#435)

* feat(shortcuts): unify action-driven shortcut and CLI routing

Centralize shortcut action metadata in one TypeScript registry and route keyboard, global shortcut, mini-window, and CLI inputs through shared runtime handlers.
Keep CLI as an abstract transport layer by emitting player-command payloads without depending on shortcut definitions.

* feat(shortcuts): generate CLI action help from shortcut registry

Move no-arg player commands and their descriptions into the central action registry so CLI parsing and --player help are derived dynamically from one source of truth. Also route runtime action execution through the registry and remove duplicated shortcut runtime handling.

* feat(shortcuts): add new input actions and hidden F1 help binding

Add the requested input actions (search, advanced search, sidebar, mute, equalizer, repeat, now playing, lyrics, favorite current track) to the central shortcut action registry and wire runtime handlers for sidebar/equalizer toggles. Keep Help bound to F1 by default while hiding it from Settings input lists, and backfill persisted keybindings with new defaults so F1 works for existing users.

Requested by @zunoz (Discord community).
This commit is contained in:
cucadmuh
2026-05-03 00:37:43 +03:00
committed by GitHub
parent 402e288a24
commit 1e05180418
11 changed files with 820 additions and 335 deletions
+16 -4
View File
@@ -229,7 +229,10 @@ export default function MiniPlayer() {
const openMiniBinding = useKeybindingsStore.getState().bindings['open-mini-player'];
if (matchInAppBinding(e, openMiniBinding)) {
e.preventDefault();
invoke('open_mini_player').catch(() => {});
emit('shortcut:run-action', {
action: 'open-mini-player',
source: 'mini-window',
}).catch(() => {});
return;
}
@@ -245,11 +248,20 @@ export default function MiniPlayer() {
if (e.key === ' ' || e.code === 'Space') {
e.preventDefault();
emit('mini:control', 'toggle').catch(() => {});
emit('shortcut:run-action', {
action: 'play-pause',
source: 'mini-window',
}).catch(() => {});
} else if (e.key === 'ArrowRight') {
emit('mini:control', 'next').catch(() => {});
emit('shortcut:run-action', {
action: 'next',
source: 'mini-window',
}).catch(() => {});
} else if (e.key === 'ArrowLeft') {
emit('mini:control', 'prev').catch(() => {});
emit('shortcut:run-action', {
action: 'prev',
source: 'mini-window',
}).catch(() => {});
}
};
window.addEventListener('keydown', onKey);