From d2913f0c0c1dd74727dd8dbe8789fc31797d963a Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 2 Feb 2026 23:24:08 -0600 Subject: [PATCH] feat(keybindings): add shortcut configuration UI (Phase 4) - Create ShortcutInput.svelte with recording mode and conflict detection - Create KeybindingsSettings.svelte modal for customizing shortcuts - Integrate settings modal accessible from shortcuts modal - Add i18n translations for configuration UI (en/es) - Visual indicators for modified shortcuts - Reset individual or all shortcuts to defaults --- src/lib/components/KeybindingsSettings.svelte | 388 ++++++++++++++++++ src/lib/components/ShortcutInput.svelte | 259 ++++++++++++ src/lib/i18n/locales/en.json | 8 + src/lib/i18n/locales/es.json | 8 + src/routes/+page.svelte | 10 +- 5 files changed, 672 insertions(+), 1 deletion(-) create mode 100644 src/lib/components/KeybindingsSettings.svelte create mode 100644 src/lib/components/ShortcutInput.svelte diff --git a/src/lib/components/KeybindingsSettings.svelte b/src/lib/components/KeybindingsSettings.svelte new file mode 100644 index 000000000..fd63cfab8 --- /dev/null +++ b/src/lib/components/KeybindingsSettings.svelte @@ -0,0 +1,388 @@ + + + + +{#if isOpen} + + + + {#if showResetConfirm} + + {/if} +{/if} + + diff --git a/src/lib/components/ShortcutInput.svelte b/src/lib/components/ShortcutInput.svelte new file mode 100644 index 000000000..d5a95f9ad --- /dev/null +++ b/src/lib/components/ShortcutInput.svelte @@ -0,0 +1,259 @@ + + +
+
+ {getActionLabel()} +
+ +
+ + + +
+ + {#if conflict} +
+ {$t('keybindings.conflict', { values: { shortcut: recordedShortcut, action: conflict.label } }) || + `"${recordedShortcut}" is already used by "${conflict.label}"`} +
+ {/if} +
+ + diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index a55e3ffd4..e308c2395 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -973,6 +973,14 @@ }, "keybindings": { "title": "Keyboard Shortcuts", + "customize": "Customize Shortcuts", + "pressKeys": "Press keys...", + "modified": "modified", + "resetToDefault": "Reset to default", + "resetAll": "Reset All to Defaults", + "resetAllConfirmTitle": "Reset All Shortcuts?", + "resetAllConfirmText": "This will reset all {count} modified shortcuts to their default values.", + "conflict": "\"{shortcut}\" is already used by \"{action}\"", "categories": { "playback": "Playback", "navigation": "Navigation", diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 1f6f8bbdd..a5888ea53 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -973,6 +973,14 @@ }, "keybindings": { "title": "Atajos de Teclado", + "customize": "Personalizar Atajos", + "pressKeys": "Presiona teclas...", + "modified": "modificados", + "resetToDefault": "Restablecer a predeterminado", + "resetAll": "Restablecer Todos", + "resetAllConfirmTitle": "¿Restablecer Todos los Atajos?", + "resetAllConfirmText": "Esto restablecerá los {count} atajos modificados a sus valores predeterminados.", + "conflict": "\"{shortcut}\" ya está siendo usado por \"{action}\"", "categories": { "playback": "Reproducción", "navigation": "Navegación", diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index e7e8579ed..6c9a5f3a3 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -318,6 +318,7 @@ import WhatsNewModal from '$lib/components/updates/WhatsNewModal.svelte'; import FlatpakWelcomeModal from '$lib/components/updates/FlatpakWelcomeModal.svelte'; import KeyboardShortcutsModal from '$lib/components/KeyboardShortcutsModal.svelte'; + import KeybindingsSettings from '$lib/components/KeybindingsSettings.svelte'; import type { ReleaseInfo } from '$lib/stores/updatesStore'; import { decideLaunchModals, @@ -498,6 +499,7 @@ let isPlaylistImportOpen = $state(false); let isAboutModalOpen = $state(false); let isShortcutsModalOpen = $state(false); + let isKeybindingsSettingsOpen = $state(false); // Track Info Modal State let isTrackInfoOpen = $state(false); @@ -3421,10 +3423,16 @@ onClose={() => isShortcutsModalOpen = false} onOpenSettings={() => { isShortcutsModalOpen = false; - navigateTo('settings'); + isKeybindingsSettingsOpen = true; }} /> + + isKeybindingsSettingsOpen = false} + /> + {#if updateRelease}