Add keyboard shortcut to settings (#1368)

This commit is contained in:
Frank Noirot
2024-02-12 18:11:47 -05:00
committed by GitHub
parent 5430c1fa66
commit b88d5c8799
2 changed files with 23 additions and 4 deletions

View File

@ -34,6 +34,8 @@ import { useCommandsContext } from 'hooks/useCommandsContext'
import { DEFAULT_PROJECT_NAME } from 'machines/settingsMachine'
import { sep } from '@tauri-apps/api/path'
import { homeCommandBarConfig } from 'lib/commandBarConfigs/homeCommandConfig'
import { useHotkeys } from 'react-hotkeys-hook'
import { isTauri } from 'lib/isTauri'
// This route only opens in the Tauri desktop context for now,
// as defined in Router.tsx, so we can use the Tauri APIs and types.
@ -60,6 +62,13 @@ const Home = () => {
})
}
}, [])
useHotkeys(
isTauri() ? 'mod+,' : 'shift+mod+,',
() => navigate(paths.HOME + paths.SETTINGS),
{
splitKey: '|',
}
)
const [state, send] = useMachine(homeMachine, {
context: {