Skip to content

High performance self-hosted photo and video management solution.

feat(web): toggle theme shortcut (#22139)

Jason Rasmussen0b20d1df9fa1
diff --git a/web/src/lib/components/shared-components/theme-button.svelte b/web/src/lib/components/shared-components/theme-button.svelte
index 17b0b539ee..1c04d855da 100644
--- a/web/src/lib/components/shared-components/theme-button.svelte
+++ b/web/src/lib/components/shared-components/theme-button.svelte
@@ -1,11 +1,22 @@
<script lang="ts">
+ import { shortcut } from '$lib/actions/shortcut';
import { defaultLang, langs, Theme } from '$lib/constants';
import { themeManager } from '$lib/managers/theme-manager.svelte';
import { lang } from '$lib/stores/preferences.store';
import { ThemeSwitcher } from '@immich/ui';
import { get } from 'svelte/store';
+
+ const handleToggleTheme = () => {
+ if (themeManager.theme.system) {
+ return;
+ }
+
+ themeManager.toggleTheme();
+ };
</script>
+<svelte:window use:shortcut={{ shortcut: { key: 't', alt: true }, onShortcut: () => handleToggleTheme() }} />
+
{#if !themeManager.theme.system}
{#await langs
.find((item) => item.code === get(lang))