From 2eeb8cf8652b507ec53acc9665dda8882cd84465 Mon Sep 17 00:00:00 2001
From: vicrodh <103399283+vicrodh@users.noreply.github.com>
Date: Mon, 9 Feb 2026 02:12:59 -0600
Subject: [PATCH] Add hardware acceleration toggle in Settings > Appearance
GPU rendering is opt-in via a toggle with restart-required toast.
Recovery from crash: QBZ_HARDWARE_ACCEL=0 qbz (env var always
overrides the stored setting). i18n keys added to all 4 locales.
---
src/lib/components/views/SettingsView.svelte | 25 ++++++++++++++++++++
src/lib/i18n/locales/de.json | 2 ++
src/lib/i18n/locales/en.json | 2 ++
src/lib/i18n/locales/es.json | 2 ++
src/lib/i18n/locales/fr.json | 2 ++
5 files changed, 33 insertions(+)
diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte
index 8a378212f..5a78d2941 100644
--- a/src/lib/components/views/SettingsView.svelte
+++ b/src/lib/components/views/SettingsView.svelte
@@ -226,6 +226,7 @@
let storageCollapsed = $state(true);
let developerCollapsed = $state(true);
let forceDmabuf = $state(false);
+ let hardwareAcceleration = $state(false);
let showLogsModal = $state(false);
// Navigation section IDs with translation keys
@@ -811,6 +812,11 @@
forceDmabuf = settings.force_dmabuf;
}).catch(() => {});
+ // Load graphics settings
+ invoke('get_graphics_settings').then((settings: any) => {
+ hardwareAcceleration = settings.hardware_acceleration;
+ }).catch(() => {});
+
// Subscribe to offline state changes
const unsubscribeOffline = subscribeOffline(() => {
offlineStatus = getOfflineStatus();
@@ -2171,6 +2177,17 @@
}
}
+ async function handleHardwareAccelerationChange(enabled: boolean) {
+ try {
+ await invoke('set_hardware_acceleration', { enabled });
+ hardwareAcceleration = enabled;
+ showToast($t('settings.developer.restartRequired'), 'info');
+ } catch (err) {
+ console.error('Failed to set hardware_acceleration:', err);
+ showToast(String(err), 'error');
+ }
+ }
+
async function handleForceDmabufChange(enabled: boolean) {
try {
await invoke('set_developer_force_dmabuf', { enabled });
@@ -2664,6 +2681,14 @@
/>
+
+
+ {$t('settings.appearance.hardwareAcceleration')}
+ {$t('settings.appearance.hardwareAccelerationDesc')}
+
+
handleHardwareAccelerationChange(v)} />
+
+
{$t('settings.appearance.tray.title')}
diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json
index 23c5f0f44..297f16d5c 100644
--- a/src/lib/i18n/locales/de.json
+++ b/src/lib/i18n/locales/de.json
@@ -611,6 +611,8 @@
"split-suggestions": "Geteilt: Vorschläge",
"split-queue": "Geteilt: Warteschlange"
},
+ "hardwareAcceleration": "Hardwarebeschleunigung (GPU)",
+ "hardwareAccelerationDesc": "GPU-beschleunigtes Rendering aktivieren. Standardmäßig deaktiviert für maximale Kompatibilität. Falls QBZ nach dem Aktivieren beim Start abstürzt: QBZ_HARDWARE_ACCEL=0 qbz",
"tray": {
"title": "Systemtray",
"enableTray": "Tray-Symbol aktivieren",
diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json
index 78435c69c..fd85fa515 100644
--- a/src/lib/i18n/locales/en.json
+++ b/src/lib/i18n/locales/en.json
@@ -629,6 +629,8 @@
"split-suggestions": "Split: Suggestions",
"split-queue": "Split: Queue"
},
+ "hardwareAcceleration": "Hardware acceleration (GPU)",
+ "hardwareAccelerationDesc": "Enable GPU-accelerated rendering. Disabled by default for maximum compatibility. If QBZ crashes on startup after enabling, run: QBZ_HARDWARE_ACCEL=0 qbz",
"tray": {
"title": "System Tray",
"enableTray": "Enable tray icon",
diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json
index c442ddd69..a267ce6e6 100644
--- a/src/lib/i18n/locales/es.json
+++ b/src/lib/i18n/locales/es.json
@@ -629,6 +629,8 @@
"split-suggestions": "Dividido: Sugerencias",
"split-queue": "Dividido: Cola"
},
+ "hardwareAcceleration": "Aceleración por hardware (GPU)",
+ "hardwareAccelerationDesc": "Habilitar renderizado acelerado por GPU. Desactivado por defecto para máxima compatibilidad. Si QBZ se cierra al iniciar después de activar esto, ejecuta: QBZ_HARDWARE_ACCEL=0 qbz",
"tray": {
"title": "Bandeja del Sistema",
"enableTray": "Habilitar icono de bandeja",
diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json
index feef3a737..676925bf6 100644
--- a/src/lib/i18n/locales/fr.json
+++ b/src/lib/i18n/locales/fr.json
@@ -611,6 +611,8 @@
"split-suggestions": "Divisé : Suggestions",
"split-queue": "Divisé : File d'attente"
},
+ "hardwareAcceleration": "Accélération matérielle (GPU)",
+ "hardwareAccelerationDesc": "Activer le rendu accéléré par GPU. Désactivé par défaut pour une compatibilité maximale. Si QBZ plante au démarrage après activation : QBZ_HARDWARE_ACCEL=0 qbz",
"tray": {
"title": "Barre d'état système",
"enableTray": "Activer l'icône dans la barre système",