diff --git a/src/renderer/features/settings/components/hotkeys/hotkey-manager-settings.tsx b/src/renderer/features/settings/components/hotkeys/hotkey-manager-settings.tsx index 1db5c987..5d949a0d 100644 --- a/src/renderer/features/settings/components/hotkeys/hotkey-manager-settings.tsx +++ b/src/renderer/features/settings/components/hotkeys/hotkey-manager-settings.tsx @@ -11,6 +11,8 @@ import { SettingsOptions } from '/@/renderer/features/settings/components/settin const ipc = isElectron() ? window.electron.ipc : null; const BINDINGS_MAP: Record = { + browserBack: 'Browser back', + browserForward: 'Browser forward', globalSearch: 'Global search', localSearch: 'In-page search', next: 'Next track', diff --git a/src/renderer/features/settings/components/hotkeys/hotkeys-tab.tsx b/src/renderer/features/settings/components/hotkeys/hotkeys-tab.tsx index 73869afc..9cc89c5a 100644 --- a/src/renderer/features/settings/components/hotkeys/hotkeys-tab.tsx +++ b/src/renderer/features/settings/components/hotkeys/hotkeys-tab.tsx @@ -1,12 +1,17 @@ import { Divider, Stack } from '@mantine/core'; +import isElectron from 'is-electron'; import { WindowHotkeySettings } from './window-hotkey-settings'; import { HotkeyManagerSettings } from '/@/renderer/features/settings/components/hotkeys/hotkey-manager-settings'; export const HotkeysTab = () => { return ( - - + {isElectron() && ( + <> + + + + )} ); diff --git a/src/renderer/layouts/default-layout.tsx b/src/renderer/layouts/default-layout.tsx index 00736fa5..85eb6129 100644 --- a/src/renderer/layouts/default-layout.tsx +++ b/src/renderer/layouts/default-layout.tsx @@ -1,5 +1,6 @@ import { lazy } from 'react'; import isElectron from 'is-electron'; +import { useNavigate } from 'react-router'; import styled from 'styled-components'; import { useWindowSettings, @@ -54,6 +55,7 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => { const { windowBarStyle } = useWindowSettings(); const { opened, ...handlers } = useCommandPalette(); const { bindings } = useHotkeySettings(); + const navigate = useNavigate(); const localSettings = isElectron() ? window.electron.localSettings : null; const settings = useGeneralSettings(); const { setSettings } = useSettingsStoreActions(); @@ -78,6 +80,8 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => { useHotkeys([ [bindings.globalSearch.hotkey, () => handlers.open()], + [bindings.browserBack.hotkey, () => navigate(-1)], + [bindings.browserForward.hotkey, () => navigate(1)], ...(isElectron() ? zoomHotkeys : []), ]); diff --git a/src/renderer/store/settings.store.ts b/src/renderer/store/settings.store.ts index 8e2525c4..9fdc6870 100644 --- a/src/renderer/store/settings.store.ts +++ b/src/renderer/store/settings.store.ts @@ -81,6 +81,8 @@ type MpvSettings = { }; export enum BindingActions { + BROWSER_BACK = 'browserBack', + BROWSER_FORWARD = 'browserForward', GLOBAL_SEARCH = 'globalSearch', LOCAL_SEARCH = 'localSearch', MUTE = 'volumeMute', @@ -221,6 +223,8 @@ const initialState: SettingsState = { }, hotkeys: { bindings: { + browserBack: { allowGlobal: false, hotkey: '', isGlobal: false }, + browserForward: { allowGlobal: false, hotkey: '', isGlobal: false }, globalSearch: { allowGlobal: false, hotkey: 'mod+k', isGlobal: false }, localSearch: { allowGlobal: false, hotkey: 'mod+f', isGlobal: false }, next: { allowGlobal: true, hotkey: '', isGlobal: false },