web: handle global keyboard shortcuts

This commit is contained in:
dumbmoron 2024-07-03 17:51:01 +00:00
parent 743338ea4c
commit 70339b7ae9
No known key found for this signature in database

View file

@ -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]}>