From b5b01f78dbd3abb820a920c17626d6d8c0de9e38 Mon Sep 17 00:00:00 2001 From: Robert Sammelson Date: Mon, 5 Dec 2022 13:37:49 -0500 Subject: [PATCH] Keyboard shortcut to go to current song (#2029) * feat(hotkeys): keyboard-shortcut-for-current-song - #1336 Signed-off-by: Pavithra Nair * Fix previously mentioned bugs Signed-off-by: Pavithra Nair Co-authored-by: Pavithra Nair --- ui/src/audioplayer/keyHandlers.js | 4 +++- ui/src/hotkeys.js | 1 + ui/src/i18n/en.json | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/audioplayer/keyHandlers.js b/ui/src/audioplayer/keyHandlers.js index 3f697a32f..444ea2c12 100644 --- a/ui/src/audioplayer/keyHandlers.js +++ b/ui/src/audioplayer/keyHandlers.js @@ -25,7 +25,9 @@ const keyHandlers = (audioInstance, playerState) => { PREV_SONG: (e) => { if (!e.metaKey && prevSong()) audioInstance && audioInstance.playPrev() }, - + CURRENT_SONG: () => { + window.location.href = `#/album/${playerState.current?.song.albumId}/show` + }, NEXT_SONG: (e) => { if (!e.metaKey && nextSong()) audioInstance && audioInstance.playNext() }, diff --git a/ui/src/hotkeys.js b/ui/src/hotkeys.js index 327d4b715..f4e99b287 100644 --- a/ui/src/hotkeys.js +++ b/ui/src/hotkeys.js @@ -5,6 +5,7 @@ const keyMap = { TOGGLE_PLAY: { name: 'toggle_play', sequence: 'space', group: 'Player' }, PREV_SONG: { name: 'prev_song', sequence: 'left', group: 'Player' }, NEXT_SONG: { name: 'next_song', sequence: 'right', group: 'Player' }, + CURRENT_SONG: { name: 'current_song', sequence: 'c', group: 'Player' }, VOL_UP: { name: 'vol_up', sequence: '=', group: 'Player' }, VOL_DOWN: { name: 'vol_down', sequence: '-', group: 'Player' }, ...(config.enableFavourites && { diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json index cc40dcf99..688729166 100644 --- a/ui/src/i18n/en.json +++ b/ui/src/i18n/en.json @@ -393,6 +393,7 @@ "toggle_play": "Play / Pause", "prev_song": "Previous Song", "next_song": "Next Song", + "current_song": "Current Song", "vol_up": "Volume Up", "vol_down": "Volume Down", "toggle_love": "Add this track to favourites"