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.
This commit is contained in:
vicrodh committed 2026-02-09 02:12:59 -06:00
1 parent 3cd7e7c55f
commit 2eeb8cf865
5 files changed
+33

No files matched your search

@@ -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 @@
/>
</div>
<div class="setting-row">
<div class="setting-info">
<span class="setting-label">{$t('settings.appearance.hardwareAcceleration')}</span>
<span class="setting-desc">{$t('settings.appearance.hardwareAccelerationDesc')}</span>
</div>
<Toggle enabled={hardwareAcceleration} onchange={(v) => handleHardwareAccelerationChange(v)} />
</div>
<!-- System Tray subsection -->
<h4 class="subsection-title">{$t('settings.appearance.tray.title')}</h4>
<div class="setting-row">