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)} />