fix(settings): simplify title bar settings to hide-only option

Remove "Use QBZ title bar" toggle since switching to system decorations
doesn't work reliably on Linux when the window was created without
decorations. Keep only "Hide title bar" option for tiling WM users.
This commit is contained in:
vicrodh committed 2026-01-23 16:28:50 -06:00
1 parent 150513179d
commit 3fb597f3fb
5 files changed
+8 -87

No files matched your search

@@ -46,9 +46,7 @@
import { showToast } from '$lib/stores/toastStore'; import { showToast } from '$lib/stores/toastStore';
import { import {
subscribe as subscribeTitleBar, subscribe as subscribeTitleBar,
getUseCustomTitleBar,
getHideTitleBar, getHideTitleBar,
setUseCustomTitleBar,
setHideTitleBar setHideTitleBar
} from '$lib/stores/titleBarStore'; } from '$lib/stores/titleBarStore';
import { import {
@@ -376,7 +374,6 @@
let language = $state('Auto'); let language = $state('Auto');
// Title bar settings // Title bar settings
let useCustomTitleBar = $state(getUseCustomTitleBar());
let hideTitleBar = $state(getHideTitleBar()); let hideTitleBar = $state(getHideTitleBar());
// Library settings // Library settings
@@ -483,7 +480,6 @@
// Subscribe to title bar state changes // Subscribe to title bar state changes
const unsubscribeTitleBar = subscribeTitleBar(() => { const unsubscribeTitleBar = subscribeTitleBar(() => {
useCustomTitleBar = getUseCustomTitleBar();
hideTitleBar = getHideTitleBar(); hideTitleBar = getHideTitleBar();
}); });
@@ -1682,17 +1678,6 @@
<span class="setting-label">{$t('settings.appearance.systemNotifications')}</span> <span class="setting-label">{$t('settings.appearance.systemNotifications')}</span>
<Toggle enabled={systemNotificationsEnabled} onchange={(v) => { systemNotificationsEnabled = v; setSystemNotificationsEnabled(v); }} /> <Toggle enabled={systemNotificationsEnabled} onchange={(v) => { systemNotificationsEnabled = v; setSystemNotificationsEnabled(v); }} />
</div> </div>
<div class="setting-row">
<div class="setting-info">
<span class="setting-label">{$t('settings.appearance.useCustomTitleBar')}</span>
<span class="setting-desc">{$t('settings.appearance.useCustomTitleBarDesc')}</span>
</div>
<Toggle
enabled={useCustomTitleBar}
disabled={hideTitleBar}
onchange={(v) => setUseCustomTitleBar(v)}
/>
</div>
<div class="setting-row last"> <div class="setting-row last">
<div class="setting-info"> <div class="setting-info">
<span class="setting-label">{$t('settings.appearance.hideTitleBar')}</span> <span class="setting-label">{$t('settings.appearance.hideTitleBar')}</span>
+1 -3
View File
@@ -364,9 +364,7 @@
"uiScale": "UI Scale", "uiScale": "UI Scale",
"inAppToasts": "In-app toasts notifications", "inAppToasts": "In-app toasts notifications",
"systemNotifications": "System Notifications", "systemNotifications": "System Notifications",
"useCustomTitleBar": "Use QBZ title bar", "hideTitleBar": "Hide title bar",
"useCustomTitleBarDesc": "Use the custom QBZ title bar instead of system decorations",
"hideTitleBar": "Remove title bar",
"hideTitleBarDesc": "Hide the title bar completely (for tiling window manager users)" "hideTitleBarDesc": "Hide the title bar completely (for tiling window manager users)"
}, },
"library": { "library": {
-2
View File
@@ -364,8 +364,6 @@
"uiScale": "Escala de UI", "uiScale": "Escala de UI",
"inAppToasts": "Notificaciones en App", "inAppToasts": "Notificaciones en App",
"systemNotifications": "Notificaciones del Sistema", "systemNotifications": "Notificaciones del Sistema",
"useCustomTitleBar": "Usar barra de título de QBZ",
"useCustomTitleBarDesc": "Usar la barra de título personalizada de QBZ en lugar de las decoraciones del sistema",
"hideTitleBar": "Ocultar barra de título", "hideTitleBar": "Ocultar barra de título",
"hideTitleBarDesc": "Ocultar completamente la barra de título (para usuarios de gestores de ventanas en mosaico)" "hideTitleBarDesc": "Ocultar completamente la barra de título (para usuarios de gestores de ventanas en mosaico)"
}, },
+7 -66
View File
@@ -4,17 +4,12 @@
* Manages title bar visibility settings with localStorage persistence. * Manages title bar visibility settings with localStorage persistence.
* *
* Settings: * Settings:
* - useCustomTitleBar: Use QBZ custom title bar (default: true)
* - hideTitleBar: Remove title bar completely for tiling WM users (default: false) * - hideTitleBar: Remove title bar completely for tiling WM users (default: false)
*/ */
import { getCurrentWindow } from '@tauri-apps/api/window';
const STORAGE_KEY_CUSTOM = 'qbz-use-custom-titlebar';
const STORAGE_KEY_HIDE = 'qbz-hide-titlebar'; const STORAGE_KEY_HIDE = 'qbz-hide-titlebar';
// State // State
let useCustomTitleBar = true;
let hideTitleBar = false; let hideTitleBar = false;
// Listeners // Listeners
@@ -27,22 +22,14 @@ function notifyListeners(): void {
} }
/** /**
* Initialize the store from localStorage and apply settings * Initialize the store from localStorage
*/ */
export async function initTitleBarStore(): Promise<void> { export function initTitleBarStore(): void {
try { try {
const savedCustom = localStorage.getItem(STORAGE_KEY_CUSTOM);
const savedHide = localStorage.getItem(STORAGE_KEY_HIDE); const savedHide = localStorage.getItem(STORAGE_KEY_HIDE);
if (savedCustom !== null) {
useCustomTitleBar = savedCustom === 'true';
}
if (savedHide !== null) { if (savedHide !== null) {
hideTitleBar = savedHide === 'true'; hideTitleBar = savedHide === 'true';
} }
// Apply settings to window
await applyTitleBarSettings();
} catch (e) { } catch (e) {
console.error('[TitleBarStore] Failed to initialize:', e); console.error('[TitleBarStore] Failed to initialize:', e);
} }
@@ -58,24 +45,17 @@ export function subscribe(listener: () => void): () => void {
} }
/** /**
* Get current settings * Get current setting
*/ */
export function getUseCustomTitleBar(): boolean {
return useCustomTitleBar;
}
export function getHideTitleBar(): boolean { export function getHideTitleBar(): boolean {
return hideTitleBar; return hideTitleBar;
} }
/** /**
* Determine if the custom title bar should be visible * Determine if the title bar should be visible
* - Hidden if hideTitleBar is true (tiling WM mode)
* - Hidden if useCustomTitleBar is false (using system decorations)
*/ */
export function shouldShowTitleBar(): boolean { export function shouldShowTitleBar(): boolean {
if (hideTitleBar) return false; return !hideTitleBar;
return useCustomTitleBar;
} }
/** /**
@@ -83,53 +63,16 @@ export function shouldShowTitleBar(): boolean {
* Returns 0 if title bar is hidden, 32 otherwise * Returns 0 if title bar is hidden, 32 otherwise
*/ */
export function getTitleBarHeight(): number { export function getTitleBarHeight(): number {
return shouldShowTitleBar() ? 32 : 0; return hideTitleBar ? 0 : 32;
}
/**
* Apply current settings to the Tauri window
*/
async function applyTitleBarSettings(): Promise<void> {
try {
const appWindow = getCurrentWindow();
if (hideTitleBar) {
// No title bar at all - remove decorations
await appWindow.setDecorations(false);
} else if (useCustomTitleBar) {
// Custom title bar - no system decorations
await appWindow.setDecorations(false);
} else {
// System title bar - enable decorations
await appWindow.setDecorations(true);
}
} catch (e) {
console.error('[TitleBarStore] Failed to apply settings:', e);
}
}
/**
* Set whether to use custom title bar
*/
export async function setUseCustomTitleBar(value: boolean): Promise<void> {
useCustomTitleBar = value;
try {
localStorage.setItem(STORAGE_KEY_CUSTOM, String(value));
await applyTitleBarSettings();
} catch (e) {
console.error('[TitleBarStore] Failed to save custom titlebar setting:', e);
}
notifyListeners();
} }
/** /**
* Set whether to hide title bar completely * Set whether to hide title bar completely
*/ */
export async function setHideTitleBar(value: boolean): Promise<void> { export function setHideTitleBar(value: boolean): void {
hideTitleBar = value; hideTitleBar = value;
try { try {
localStorage.setItem(STORAGE_KEY_HIDE, String(value)); localStorage.setItem(STORAGE_KEY_HIDE, String(value));
await applyTitleBarSettings();
} catch (e) { } catch (e) {
console.error('[TitleBarStore] Failed to save hide titlebar setting:', e); console.error('[TitleBarStore] Failed to save hide titlebar setting:', e);
} }
@@ -137,7 +80,6 @@ export async function setHideTitleBar(value: boolean): Promise<void> {
} }
export interface TitleBarState { export interface TitleBarState {
useCustomTitleBar: boolean;
hideTitleBar: boolean; hideTitleBar: boolean;
showTitleBar: boolean; showTitleBar: boolean;
titleBarHeight: number; titleBarHeight: number;
@@ -145,7 +87,6 @@ export interface TitleBarState {
export function getTitleBarState(): TitleBarState { export function getTitleBarState(): TitleBarState {
return { return {
useCustomTitleBar,
hideTitleBar, hideTitleBar,
showTitleBar: shouldShowTitleBar(), showTitleBar: shouldShowTitleBar(),
titleBarHeight: getTitleBarHeight() titleBarHeight: getTitleBarHeight()
-1
View File
@@ -75,7 +75,6 @@
import { import {
subscribe as subscribeTitleBar, subscribe as subscribeTitleBar,
initTitleBarStore, initTitleBarStore,
getTitleBarState,
shouldShowTitleBar shouldShowTitleBar
} from '$lib/stores/titleBarStore'; } from '$lib/stores/titleBarStore';