diff --git a/src/pages/Startup.tsx b/src/pages/Startup.tsx index 84c8616..907f86d 100644 --- a/src/pages/Startup.tsx +++ b/src/pages/Startup.tsx @@ -43,6 +43,23 @@ export default function Startup() { const [titleIndex, setTitleIndex] = useState(0) const startupStatus = useStore((state) => state.startupStatus) + const toolbarShortcut = usePersistedStore((state) => state.toolbarShortcut) + + const shortcutDisplay = useMemo(() => { + const raw = toolbarShortcut ?? 'CmdOrCtrl+Shift+/' + return raw + .split('+') + .map((part) => + part === 'CmdOrCtrl' + ? platform() === 'macos' + ? '⌘' + : 'Ctrl' + : part === 'Command' + ? '⌘' + : part + ) + .join(' + ') + }, [toolbarShortcut]) const isError = useMemo( () => startupStatus === 'error' || startupStatus === 'fatal', @@ -110,8 +127,7 @@ export default function Startup() { exit={{ opacity: 0 }} className="ml-2 text-2xl" > - Use the {platform() === 'macos' ? '⌘' : 'Ctrl'} + Shift + / shortcut - to open the Toolbar! + Use the {shortcutDisplay} shortcut to open the Toolbar! )} {startupStatus === 'updated' && ( diff --git a/store/persisted.ts b/store/persisted.ts index 160b650..a4ddcd5 100644 --- a/store/persisted.ts +++ b/store/persisted.ts @@ -390,9 +390,11 @@ export const usePersistedStore = create()( ) ) -// useStore.persist.onFinishHydration(() => { -// console.log('onFinishHydration') -// }) +usePersistedStore.persist.onFinishHydration((state) => { + if (state.toolbarShortcut) { + invoke('update_toolbar_shortcut', { shortcut: state.toolbarShortcut }) + } +}) store.onKeyChange('store', async (_) => { await usePersistedStore.persist.rehydrate()