From aed7e43c0f0b70c19205f37b31b7ecd41a365ceb Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Tue, 10 Feb 2026 20:32:40 -0600 Subject: [PATCH] feat(settings): add collapsible Composition section in Appearance Replace the misleading Hardware Acceleration toggle (which was a no-op since v1.1.12 reverted to env-var-only control) and the standalone Force X11 toggle with a collapsible "Composition" subsection that: - Groups all GPU/rendering settings in one place - Shows help text explaining what the section controls - Includes a crash recovery warning with terminal command - Keeps Force X11 toggle (functional, writes to DB) - Adds GDK_SCALE and GDK_DPI_SCALE inputs (shown when Force X11 on) - Lists all env var overrides with descriptions - Translated in all 4 locales (en, es, de, fr) --- src/lib/components/views/SettingsView.svelte | 239 ++++++++++++++++--- src/lib/i18n/locales/de.json | 21 ++ src/lib/i18n/locales/en.json | 48 ++-- src/lib/i18n/locales/es.json | 54 +++-- src/lib/i18n/locales/fr.json | 21 ++ 5 files changed, 315 insertions(+), 68 deletions(-) diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index 4eb9f55e1..fb2711265 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -5,7 +5,7 @@ import { getCurrentWebview } from '@tauri-apps/api/webview'; import { writeText as copyToClipboard } from '@tauri-apps/plugin-clipboard-manager'; import { ask } from '@tauri-apps/plugin-dialog'; - import { ArrowLeft, ChevronRight, ChevronDown, ChevronUp, Loader2, Sun, Moon, SunMoon, HelpCircle, Ban } from 'lucide-svelte'; + import { ArrowLeft, ChevronRight, ChevronDown, ChevronUp, Loader2, Sun, Moon, SunMoon, HelpCircle, Ban, AlertTriangle } from 'lucide-svelte'; import Toggle from '../Toggle.svelte'; import Dropdown from '../Dropdown.svelte'; import DeviceDropdown from '../DeviceDropdown.svelte'; @@ -264,8 +264,10 @@ let storageCollapsed = $state(true); let developerCollapsed = $state(true); let forceDmabuf = $state(false); - let hardwareAcceleration = $state(false); let forceX11 = $state(false); + let gdkScale = $state(''); + let gdkDpiScale = $state(''); + let compositionCollapsed = $state(true); let showLogsModal = $state(false); // Navigation section IDs with translation keys @@ -892,8 +894,9 @@ // Load graphics settings invoke('get_graphics_settings').then((settings: any) => { - hardwareAcceleration = settings.hardware_acceleration; forceX11 = settings.force_x11; + gdkScale = settings.gdk_scale || ''; + gdkDpiScale = settings.gdk_dpi_scale || ''; }).catch(() => {}); // Subscribe to offline state changes @@ -2708,17 +2711,6 @@ } } - 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 handleForceX11Change(enabled: boolean) { try { await invoke('set_force_x11', { enabled }); @@ -2730,6 +2722,28 @@ } } + async function handleGdkScaleChange() { + try { + const value = gdkScale.trim() || null; + await invoke('set_gdk_scale', { value }); + showToast($t('settings.developer.restartRequired'), 'info'); + } catch (err) { + console.error('Failed to set gdk_scale:', err); + showToast(String(err), 'error'); + } + } + + async function handleGdkDpiScaleChange() { + try { + const value = gdkDpiScale.trim() || null; + await invoke('set_gdk_dpi_scale', { value }); + showToast($t('settings.developer.restartRequired'), 'info'); + } catch (err) { + console.error('Failed to set gdk_dpi_scale:', err); + showToast(String(err), 'error'); + } + } + async function handleForceDmabufChange(enabled: boolean) { try { await invoke('set_developer_force_dmabuf', { enabled }); @@ -3230,19 +3244,96 @@ /> -
-
- {$t('settings.appearance.hardwareAcceleration')} - {$t('settings.appearance.hardwareAccelerationDesc')} -
- handleHardwareAccelerationChange(v)} /> -
-
-
- {$t('settings.appearance.forceX11')} - {$t('settings.appearance.forceX11Desc')} -
- handleForceX11Change(v)} /> + +
+ + {#if !compositionCollapsed} +

{$t('settings.appearance.composition.helpText')}

+ +
+ +
+ {$t('settings.appearance.composition.recoveryNote')} + {$t('settings.appearance.composition.recoveryCmd')} +
+
+ +
+
+ {$t('settings.appearance.composition.forceX11')} + {$t('settings.appearance.composition.forceX11Desc')} +
+ handleForceX11Change(v)} /> +
+ + {#if forceX11} +
+
+ {$t('settings.appearance.composition.gdkScale')} + {$t('settings.appearance.composition.gdkScaleDesc')} +
+ +
+
+
+ {$t('settings.appearance.composition.gdkDpiScale')} + {$t('settings.appearance.composition.gdkDpiScaleDesc')} +
+ +
+ {/if} + +
+ {$t('settings.appearance.composition.envVarsTitle')} +

{$t('settings.appearance.composition.envVarsDesc')}

+
+
+ QBZ_HARDWARE_ACCEL=0 + {$t('settings.appearance.composition.envVarHwAccel0')} +
+
+ QBZ_HARDWARE_ACCEL=1 + {$t('settings.appearance.composition.envVarHwAccel1')} +
+
+ QBZ_FORCE_X11=1 + {$t('settings.appearance.composition.envVarForceX11')} +
+
+ QBZ_SOFTWARE_RENDER=1 + {$t('settings.appearance.composition.envVarSoftwareRender')} +
+
+ QBZ_FORCE_DMABUF=1 + {$t('settings.appearance.composition.envVarForceDmabuf')} +
+
+ QBZ_DISABLE_DMABUF=1 + {$t('settings.appearance.composition.envVarDisableDmabuf')} +
+
+
+ {/if}
@@ -4677,6 +4768,100 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz margin-left: -4px; } + /* Composition subsection (inside Appearance) */ + .composition-subsection { + padding-top: 16px; + margin-top: 8px; + border-top: 1px solid var(--border-color); + } + + .composition-title { + font-size: 14px !important; + } + + .composition-warning { + display: flex; + align-items: flex-start; + gap: 8px; + padding: 10px 12px; + margin-bottom: 16px; + border-radius: 8px; + background: rgba(245, 158, 11, 0.08); + border: 1px solid rgba(245, 158, 11, 0.2); + font-size: 12px; + color: var(--text-secondary); + } + + .composition-warning :global(svg) { + flex-shrink: 0; + color: #f59e0b; + margin-top: 1px; + } + + .recovery-cmd { + display: block; + margin-top: 4px; + padding: 4px 8px; + border-radius: 4px; + background: var(--bg-tertiary); + font-family: monospace; + font-size: 12px; + color: var(--text-primary); + user-select: all; + } + + .composition-input { + width: 80px; + padding: 6px 8px; + border-radius: 8px; + border: 1px solid var(--bg-tertiary); + background: var(--bg-secondary); + color: var(--text-primary); + font-size: 12px; + text-align: center; + } + + .composition-env-section { + margin-top: 16px; + padding-top: 16px; + border-top: 1px solid var(--border-color); + } + + .composition-env-title { + font-size: 13px; + font-weight: 600; + color: var(--text-secondary); + text-transform: uppercase; + letter-spacing: 0.5px; + } + + .env-vars-list { + display: flex; + flex-direction: column; + gap: 6px; + } + + .env-var-row { + display: flex; + align-items: baseline; + gap: 12px; + font-size: 12px; + } + + .env-var-row code { + flex-shrink: 0; + padding: 2px 6px; + border-radius: 4px; + background: var(--bg-tertiary); + font-family: monospace; + font-size: 11px; + color: var(--text-primary); + } + + .env-var-row span { + color: var(--text-muted); + } + .setting-row { display: flex; align-items: center; diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 3d90a3ed6..9754d0652 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -652,6 +652,27 @@ "minimizeToTrayDesc": "Fenster beim Minimieren in den Tray verschieben", "closeToTray": "In den Systemtray schließen", "closeToTrayDesc": "Fenster in den Tray minimieren statt beenden" + }, + "composition": { + "title": "Komposition", + "summary": "Visuelle Rendering- und GPU-Beschleunigungseinstellungen", + "helpText": "Diese Einstellungen steuern, wie QBZ die Benutzeroberflaeche rendert. Falsche Einstellungen koennen zu Abstuerzen oder schlechter Leistung fuehren. Alle Optionen erfordern einen Neustart.", + "recoveryNote": "Falls QBZ nach dem Aendern dieser Einstellungen abstuerzt, starte vom Terminal mit:", + "recoveryCmd": "QBZ_HARDWARE_ACCEL=0 qbz", + "forceX11": "X11-Backend erzwingen (Wayland)", + "forceX11Desc": "XWayland statt nativem Wayland verwenden. Empfohlen fuer NVIDIA-GPUs mit Wayland-Abstuerzen.", + "gdkScale": "Anzeigeskalierung (XWayland)", + "gdkScaleDesc": "GDK_SCALE-Override fuer XWayland. Leer lassen fuer Auto.", + "gdkDpiScale": "DPI-Skalierung (XWayland)", + "gdkDpiScaleDesc": "GDK_DPI_SCALE-Override fuer XWayland. Leer lassen fuer Auto.", + "envVarsTitle": "Umgebungsvariablen (Override)", + "envVarsDesc": "Fuer fortgeschrittene Benutzer. Vor dem Start von QBZ setzen, um alle Einstellungen zu ueberschreiben.", + "envVarHwAccel0": "Gesamtes GPU-Rendering deaktivieren (maximale Kompatibilitaet)", + "envVarHwAccel1": "Volles GPU-Rendering erzwingen (alle Sicherheiten umgehen)", + "envVarForceX11": "XWayland-Backend erzwingen", + "envVarSoftwareRender": "Software-Rendering erzwingen (Mesa llvmpipe)", + "envVarForceDmabuf": "DMA-BUF-Renderer erzwingen (kann abstuerzen)", + "envVarDisableDmabuf": "DMA-BUF-Renderer deaktivieren" } }, "library": { diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index 0e0390e7b..eaa37d0ab 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -230,12 +230,16 @@ "playlists": "Playlists" }, "sort": { - "label": "Sort", + "nameAZ": "Name (A-Z)", + "recent": "Recent", + "trackCount": "# of Tracks", + "playCount": "Play Count", + "custom": "Custom", "default": "Default", "newest": "Newest First", "oldest": "Oldest First", - "titleAsc": "Title (A-Z)", - "titleDesc": "Title (Z-A)", + "titleAZ": "Title (A-Z)", + "titleZA": "Title (Z-A)", "artist": "Artist" }, "playlist": { @@ -302,19 +306,6 @@ "suggestSongs": "Suggest songs for this playlist", "suggestionsLargePlaylist": "This playlist has many tracks. Tap the button to generate suggestions." }, - "sort": { - "nameAZ": "Name (A-Z)", - "recent": "Recent", - "trackCount": "# of Tracks", - "playCount": "Play Count", - "custom": "Custom", - "default": "Default", - "newest": "Newest First", - "oldest": "Oldest First", - "titleAZ": "Title (A-Z)", - "titleZA": "Title (Z-A)", - "artist": "Artist" - }, "favorites": { "title": "Favorites", "albums": "Albums", @@ -398,7 +389,7 @@ "lyrics": "Lyrics", "noLyrics": "No lyrics available", "fetchingLyrics": "Fetching lyrics...", -"trackUnavailable": "Track no longer available in Qobuz library", + "trackUnavailable": "Track no longer available in Qobuz library", "credits": "Credits", "trackInfo": "Track Info", "suggestions": "Suggestions", @@ -562,8 +553,6 @@ "parsingHardware": "Parsing hardware information", "limitQualityToDevice": "Limit Quality to Device", "limitQualityToDeviceDesc": "When enabled, overrides the quality setting above if your audio device doesn't support the selected sample rate. Prevents resampling to guarantee bit-perfect playback.", - "audioBackend": "Audio Backend", - "audioBackendDesc": "Choose audio system: Auto (recommended), PipeWire (modern), ALSA Direct (bit-perfect, exclusive), or PulseAudio (legacy).", "alsaPlugin": "ALSA Plugin", "alsaPluginDesc": "hw: Bit-perfect, exclusive. plughw: Auto-convert. pcm: Most compatible.", "hardwareVolume": "Enable Hardware Volume Control", @@ -673,6 +662,27 @@ "minimizeToTrayDesc": "Hide window to tray when minimizing", "closeToTray": "Close to tray", "closeToTrayDesc": "Hide window to tray instead of quitting" + }, + "composition": { + "title": "Composition", + "summary": "Visual rendering and GPU acceleration settings", + "helpText": "These settings control how QBZ renders the UI. Incorrect settings may cause crashes or poor performance. All options require a restart to take effect.", + "recoveryNote": "If QBZ crashes after changing these settings, launch from terminal with:", + "recoveryCmd": "QBZ_HARDWARE_ACCEL=0 qbz", + "forceX11": "Force X11 backend (Wayland)", + "forceX11Desc": "Use XWayland instead of native Wayland. Recommended for NVIDIA GPUs that crash on Wayland.", + "gdkScale": "Display scale (XWayland)", + "gdkScaleDesc": "GDK_SCALE override for XWayland. Leave empty for auto.", + "gdkDpiScale": "DPI scale (XWayland)", + "gdkDpiScaleDesc": "GDK_DPI_SCALE override for XWayland. Leave empty for auto.", + "envVarsTitle": "Environment variable overrides", + "envVarsDesc": "For advanced users. Set these before launching QBZ to override any setting above.", + "envVarHwAccel0": "Disable all GPU rendering (maximum compatibility)", + "envVarHwAccel1": "Force full GPU rendering (bypass all safety)", + "envVarForceX11": "Force XWayland backend", + "envVarSoftwareRender": "Force software rendering (Mesa llvmpipe)", + "envVarForceDmabuf": "Force DMA-BUF renderer on (may crash)", + "envVarDisableDmabuf": "Force DMA-BUF renderer off" } }, "library": { diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 953d9c270..79dbaf3e9 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -230,12 +230,16 @@ "playlists": "Playlists" }, "sort": { - "label": "Ordenar", + "nameAZ": "Nombre (A-Z)", + "recent": "Reciente", + "trackCount": "# de Pistas", + "playCount": "Reproducciones", + "custom": "Personalizado", "default": "Por defecto", - "newest": "Más reciente", - "oldest": "Más antiguo", - "titleAsc": "Título (A-Z)", - "titleDesc": "Título (Z-A)", + "newest": "Más Nuevos", + "oldest": "Más Antiguos", + "titleAZ": "Título (A-Z)", + "titleZA": "Título (Z-A)", "artist": "Artista" }, "playlist": { @@ -302,19 +306,6 @@ "suggestSongs": "Sugerir canciones para esta lista", "suggestionsLargePlaylist": "Esta lista tiene muchas pistas. Presiona el botón para generar sugerencias." }, - "sort": { - "nameAZ": "Nombre (A-Z)", - "recent": "Reciente", - "trackCount": "# de Pistas", - "playCount": "Reproducciones", - "custom": "Personalizado", - "default": "Por defecto", - "newest": "Más Nuevos", - "oldest": "Más Antiguos", - "titleAZ": "Título (A-Z)", - "titleZA": "Título (Z-A)", - "artist": "Artista" - }, "favorites": { "title": "Favoritos", "albums": "Álbumes", @@ -398,7 +389,7 @@ "lyrics": "Letras", "noLyrics": "No hay letras disponibles", "fetchingLyrics": "Buscando letras...", -"trackUnavailable": "Pista ya no disponible en la biblioteca de Qobuz", + "trackUnavailable": "Pista ya no disponible en la biblioteca de Qobuz", "credits": "Créditos", "trackInfo": "Info de Pista", "suggestions": "Sugerencias", @@ -554,7 +545,7 @@ "dacPassthroughDisabledDesc": "DAC Passthrough usa pw-metadata para forzar las tasas de muestreo de PipeWire. Solo es compatible con el backend PipeWire.", "dacPassthroughExtendedDesc": "Cuando está habilitado, anula la configuración de calidad anterior si tu dispositivo de audio no soporta la tasa de muestreo seleccionada. Previene el remuestreo para garantizar reproducción bit-perfect.", "audioBackend": "Backend de Audio", - "audioBackendDesc": "Elige el sistema de audio: Auto (recomendado), PipeWire (moderno), ALSA Direct (bit-perfect, exclusivo), o PulseAudio (legado).", + "audioBackendDesc": "Elige el sistema de audio: Auto (recomendado), PipeWire (moderno), ALSA Direct (bit-perfect, exclusivo), o PulseAudio (legacy).", "currentSampleRate": "Tasa de Muestreo Actual", "noActivePlayback": "Sin reproducción activa", "loadingDevices": "Cargando dispositivos...", @@ -562,8 +553,6 @@ "parsingHardware": "Analizando información de hardware", "limitQualityToDevice": "Limitar Calidad al Dispositivo", "limitQualityToDeviceDesc": "Cuando está activado, anula la configuración de calidad si tu dispositivo de audio no soporta la tasa de muestreo seleccionada. Previene el remuestreo para garantizar reproducción bit-perfect.", - "audioBackend": "Backend de Audio", - "audioBackendDesc": "Elige el sistema de audio: Auto (recomendado), PipeWire (moderno), ALSA Direct (bit-perfect, exclusivo), o PulseAudio (legacy).", "alsaPlugin": "Plugin ALSA", "alsaPluginDesc": "hw: Bit-perfect, exclusivo. plughw: Auto-conversión. pcm: Más compatible.", "hardwareVolume": "Habilitar Control de Volumen por Hardware", @@ -673,6 +662,27 @@ "minimizeToTrayDesc": "Ocultar ventana a la bandeja al minimizar", "closeToTray": "Cerrar a bandeja", "closeToTrayDesc": "Ocultar ventana a la bandeja en vez de cerrar" + }, + "composition": { + "title": "Composicion", + "summary": "Configuracion de renderizado visual y aceleracion GPU", + "helpText": "Estos ajustes controlan como QBZ renderiza la interfaz. Una configuracion incorrecta puede causar crashes o bajo rendimiento. Todas las opciones requieren reiniciar.", + "recoveryNote": "Si QBZ crashea despues de cambiar estos ajustes, ejecuta desde terminal:", + "recoveryCmd": "QBZ_HARDWARE_ACCEL=0 qbz", + "forceX11": "Forzar X11 (Wayland)", + "forceX11Desc": "Usar XWayland en lugar de Wayland nativo. Recomendado para GPUs NVIDIA con crashes en Wayland.", + "gdkScale": "Escala de pantalla (XWayland)", + "gdkScaleDesc": "Override de GDK_SCALE para XWayland. Dejar vacio para auto.", + "gdkDpiScale": "Escala DPI (XWayland)", + "gdkDpiScaleDesc": "Override de GDK_DPI_SCALE para XWayland. Dejar vacio para auto.", + "envVarsTitle": "Variables de entorno (override)", + "envVarsDesc": "Para usuarios avanzados. Configurar antes de ejecutar QBZ para sobreescribir cualquier ajuste.", + "envVarHwAccel0": "Deshabilitar todo el renderizado GPU (maxima compatibilidad)", + "envVarHwAccel1": "Forzar renderizado GPU completo (sin protecciones)", + "envVarForceX11": "Forzar backend XWayland", + "envVarSoftwareRender": "Forzar renderizado por software (Mesa llvmpipe)", + "envVarForceDmabuf": "Forzar DMA-BUF activo (puede crashear)", + "envVarDisableDmabuf": "Forzar DMA-BUF desactivado" } }, "library": { diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index d211fe21c..6382ae302 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -652,6 +652,27 @@ "minimizeToTrayDesc": "Masquer la fenêtre dans la barre d'état lors de la minimisation", "closeToTray": "Réduire dans la barre d'état système", "closeToTrayDesc": "Masquer la fenêtre dans la barre d'état au lieu de quitter" + }, + "composition": { + "title": "Composition", + "summary": "Parametres de rendu visuel et acceleration GPU", + "helpText": "Ces parametres controlent comment QBZ rend l'interface. Des parametres incorrects peuvent causer des crashes ou une mauvaise performance. Toutes les options necessitent un redemarrage.", + "recoveryNote": "Si QBZ plante apres avoir modifie ces parametres, lancez depuis le terminal avec :", + "recoveryCmd": "QBZ_HARDWARE_ACCEL=0 qbz", + "forceX11": "Forcer le backend X11 (Wayland)", + "forceX11Desc": "Utiliser XWayland au lieu du Wayland natif. Recommande pour les GPU NVIDIA avec des crashes sous Wayland.", + "gdkScale": "Echelle d'affichage (XWayland)", + "gdkScaleDesc": "Override GDK_SCALE pour XWayland. Laisser vide pour auto.", + "gdkDpiScale": "Echelle DPI (XWayland)", + "gdkDpiScaleDesc": "Override GDK_DPI_SCALE pour XWayland. Laisser vide pour auto.", + "envVarsTitle": "Variables d'environnement (override)", + "envVarsDesc": "Pour les utilisateurs avances. Definir avant de lancer QBZ pour remplacer tout parametre.", + "envVarHwAccel0": "Desactiver tout le rendu GPU (compatibilite maximale)", + "envVarHwAccel1": "Forcer le rendu GPU complet (contourner toutes les protections)", + "envVarForceX11": "Forcer le backend XWayland", + "envVarSoftwareRender": "Forcer le rendu logiciel (Mesa llvmpipe)", + "envVarForceDmabuf": "Forcer le rendu DMA-BUF (peut planter)", + "envVarDisableDmabuf": "Desactiver le rendu DMA-BUF" } }, "library": {