From 05ef074e4fbb24554d4a939e15fe8404d722f358 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Wed, 14 Jan 2026 02:44:27 -0600 Subject: [PATCH] feat(ui): add HiDPI zoom controls and hotkeys --- src-tauri/capabilities/default.json | 1 + src-tauri/tauri.conf.json | 3 +- src/lib/app/bootstrap.ts | 18 +++++++++ src/lib/components/views/SettingsView.svelte | 42 ++++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 66acd6d34..f0b06782a 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -28,6 +28,7 @@ "core:webview:default", "core:webview:allow-create-webview-window", "core:webview:allow-webview-close", + "core:webview:allow-set-webview-zoom", "opener:default", "dialog:default", "clipboard-manager:default", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 05eac7688..0f8ef3d25 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -19,7 +19,8 @@ "minHeight": 600, "decorations": false, "transparent": true, - "resizable": true + "resizable": true, + "zoomHotkeysEnabled": true } ], "security": { diff --git a/src/lib/app/bootstrap.ts b/src/lib/app/bootstrap.ts index 5bcd9fd34..8eae96d92 100644 --- a/src/lib/app/bootstrap.ts +++ b/src/lib/app/bootstrap.ts @@ -6,6 +6,7 @@ */ import { invoke } from '@tauri-apps/api/core'; +import { getCurrent } from '@tauri-apps/api/webview'; import { goBack, goForward } from '$lib/stores/navigationStore'; // ============ Theme Management ============ @@ -20,6 +21,22 @@ export function loadSavedTheme(): void { } } +/** + * Apply saved UI zoom level (Tauri webview zoom) + */ +export async function applySavedZoom(): Promise { + const savedZoom = localStorage.getItem('qbz-zoom-level'); + if (!savedZoom) return; + const zoom = Number.parseFloat(savedZoom); + if (!Number.isFinite(zoom) || zoom <= 0) return; + + try { + await getCurrent().setZoom(zoom); + } catch (err) { + console.warn('Failed to apply saved zoom:', err); + } +} + // ============ Last.fm Session ============ /** @@ -87,6 +104,7 @@ export interface BootstrapResult { export function bootstrapApp(): BootstrapResult { // Load theme loadSavedTheme(); + void applySavedZoom(); // Setup mouse navigation const cleanupMouse = setupMouseNavigation(); diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index ed6c3628e..739210f43 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -1,6 +1,7 @@
@@ -798,6 +832,14 @@ onchange={handleLanguageChange} />
+
+ UI Scale + +
Compact Mode (compactMode = v)} />