add hotkey to navigate to home route (#1074)

This commit is contained in:
jeffvli 2025-09-06 01:01:48 -07:00
parent b00305cc86
commit 4a28e7230a
4 changed files with 9 additions and 0 deletions

View file

@ -580,6 +580,7 @@
"hotkey_favoritePreviousSong": "favorite $t(common.previousSong)", "hotkey_favoritePreviousSong": "favorite $t(common.previousSong)",
"hotkey_globalSearch": "global search", "hotkey_globalSearch": "global search",
"hotkey_localSearch": "in-page search", "hotkey_localSearch": "in-page search",
"hotkey_navigateHome": "navigate to home",
"hotkey_playbackNext": "next track", "hotkey_playbackNext": "next track",
"hotkey_playbackPause": "pause", "hotkey_playbackPause": "pause",
"hotkey_playbackPlay": "play", "hotkey_playbackPlay": "play",

View file

@ -52,6 +52,10 @@ const BINDINGS_MAP: Record<BindingActions, string> = {
postProcess: 'sentenceCase', postProcess: 'sentenceCase',
}), }),
localSearch: i18n.t('setting.hotkey', { context: 'localSearch', postProcess: 'sentenceCase' }), localSearch: i18n.t('setting.hotkey', { context: 'localSearch', postProcess: 'sentenceCase' }),
navigateHome: i18n.t('setting.hotkey', {
context: 'navigateHome',
postProcess: 'sentenceCase',
}),
next: i18n.t('setting.hotkey', { context: 'playbackNext', postProcess: 'sentenceCase' }), next: i18n.t('setting.hotkey', { context: 'playbackNext', postProcess: 'sentenceCase' }),
pause: i18n.t('setting.hotkey', { context: 'playbackPause', postProcess: 'sentenceCase' }), pause: i18n.t('setting.hotkey', { context: 'playbackPause', postProcess: 'sentenceCase' }),
play: i18n.t('setting.hotkey', { context: 'playbackPlay', postProcess: 'sentenceCase' }), play: i18n.t('setting.hotkey', { context: 'playbackPlay', postProcess: 'sentenceCase' }),

View file

@ -10,6 +10,7 @@ import { ContextMenuProvider } from '/@/renderer/features/context-menu';
import { CommandPalette } from '/@/renderer/features/search/components/command-palette'; import { CommandPalette } from '/@/renderer/features/search/components/command-palette';
import { MainContent } from '/@/renderer/layouts/default-layout/main-content'; import { MainContent } from '/@/renderer/layouts/default-layout/main-content';
import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar'; import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar';
import { AppRoute } from '/@/renderer/router/routes';
import { useCommandPalette } from '/@/renderer/store'; import { useCommandPalette } from '/@/renderer/store';
import { import {
useGeneralSettings, useGeneralSettings,
@ -70,6 +71,7 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
[bindings.globalSearch.hotkey, () => handlers.open()], [bindings.globalSearch.hotkey, () => handlers.open()],
[bindings.browserBack.hotkey, () => navigate(-1)], [bindings.browserBack.hotkey, () => navigate(-1)],
[bindings.browserForward.hotkey, () => navigate(1)], [bindings.browserForward.hotkey, () => navigate(1)],
[bindings.navigateHome.hotkey, () => navigate(AppRoute.HOME)],
...(isElectron() ? zoomHotkeys : []), ...(isElectron() ? zoomHotkeys : []),
]); ]);

View file

@ -133,6 +133,7 @@ export enum BindingActions {
GLOBAL_SEARCH = 'globalSearch', GLOBAL_SEARCH = 'globalSearch',
LOCAL_SEARCH = 'localSearch', LOCAL_SEARCH = 'localSearch',
MUTE = 'volumeMute', MUTE = 'volumeMute',
NAVIGATE_HOME = 'navigateHome',
NEXT = 'next', NEXT = 'next',
PAUSE = 'pause', PAUSE = 'pause',
PLAY = 'play', PLAY = 'play',
@ -426,6 +427,7 @@ const initialState: SettingsState = {
favoritePreviousToggle: { allowGlobal: true, hotkey: '', isGlobal: false }, favoritePreviousToggle: { allowGlobal: true, hotkey: '', isGlobal: false },
globalSearch: { allowGlobal: false, hotkey: 'mod+k', isGlobal: false }, globalSearch: { allowGlobal: false, hotkey: 'mod+k', isGlobal: false },
localSearch: { allowGlobal: false, hotkey: 'mod+f', isGlobal: false }, localSearch: { allowGlobal: false, hotkey: 'mod+f', isGlobal: false },
navigateHome: { allowGlobal: false, hotkey: '', isGlobal: false },
next: { allowGlobal: true, hotkey: '', isGlobal: false }, next: { allowGlobal: true, hotkey: '', isGlobal: false },
pause: { allowGlobal: true, hotkey: '', isGlobal: false }, pause: { allowGlobal: true, hotkey: '', isGlobal: false },
play: { allowGlobal: true, hotkey: '', isGlobal: false }, play: { allowGlobal: true, hotkey: '', isGlobal: false },