mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 18:46:09 +00:00
web: handle global keyboard shortcuts
This commit is contained in:
parent
743338ea4c
commit
70339b7ae9
|
@ -1,4 +1,4 @@
|
|||
<script>
|
||||
<script lang="ts">
|
||||
import "@fontsource/ibm-plex-mono/400.css";
|
||||
import "@fontsource/ibm-plex-mono/500.css";
|
||||
|
||||
|
@ -7,8 +7,27 @@
|
|||
|
||||
import Sidebar from "$components/sidebar/Sidebar.svelte";
|
||||
import NotchSticker from "$components/misc/NotchSticker.svelte";
|
||||
import { goto } from "$app/navigation";
|
||||
|
||||
const handleShortcut = (e: KeyboardEvent) => {
|
||||
switch (e.key) {
|
||||
case 'B':
|
||||
goto('/about');
|
||||
break;
|
||||
case 'N':
|
||||
goto('/updates');
|
||||
break;
|
||||
case 'M':
|
||||
goto('/settings');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleShortcut} />
|
||||
|
||||
<svelte:head>
|
||||
{#if device.is.mobile}
|
||||
<meta name="theme-color" content={statusBarColors[$currentTheme]}>
|
||||
|
|
Loading…
Reference in a new issue