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 {
subscribe as subscribeTitleBar,
getUseCustomTitleBar,
getHideTitleBar,
setUseCustomTitleBar,
setHideTitleBar
} from '$lib/stores/titleBarStore';
import {
@@ -376,7 +374,6 @@
let language = $state('Auto');
// Title bar settings
let useCustomTitleBar = $state(getUseCustomTitleBar());
let hideTitleBar = $state(getHideTitleBar());
// Library settings
@@ -483,7 +480,6 @@
// Subscribe to title bar state changes
const unsubscribeTitleBar = subscribeTitleBar(() => {
useCustomTitleBar = getUseCustomTitleBar();
hideTitleBar = getHideTitleBar();
});
@@ -1682,17 +1678,6 @@
<span class="setting-label">{$t('settings.appearance.systemNotifications')}</span>
<Toggle enabled={systemNotificationsEnabled} onchange={(v) => { systemNotificationsEnabled = v; setSystemNotificationsEnabled(v); }} />
</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-info">
<span class="setting-label">{$t('settings.appearance.hideTitleBar')}</span>
+1 -3
View File
@@ -364,9 +364,7 @@
"uiScale": "UI Scale",
"inAppToasts": "In-app toasts notifications",
"systemNotifications": "System Notifications",
"useCustomTitleBar": "Use QBZ title bar",
"useCustomTitleBarDesc": "Use the custom QBZ title bar instead of system decorations",
"hideTitleBar": "Remove title bar",
"hideTitleBar": "Hide title bar",
"hideTitleBarDesc": "Hide the title bar completely (for tiling window manager users)"
},
"library": {
-2
View File
@@ -364,8 +364,6 @@
"uiScale": "Escala de UI",
"inAppToasts": "Notificaciones en App",
"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",
"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.
*
* Settings:
* - useCustomTitleBar: Use QBZ custom title bar (default: true)
* - 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';
// State
let useCustomTitleBar = true;
let hideTitleBar = false;
// 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 {
const savedCustom = localStorage.getItem(STORAGE_KEY_CUSTOM);
const savedHide = localStorage.getItem(STORAGE_KEY_HIDE);
if (savedCustom !== null) {
useCustomTitleBar = savedCustom === 'true';
}
if (savedHide !== null) {
hideTitleBar = savedHide === 'true';
}
// Apply settings to window
await applyTitleBarSettings();
} catch (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 {
return hideTitleBar;
}
/**
* Determine if the custom title bar should be visible
* - Hidden if hideTitleBar is true (tiling WM mode)
* - Hidden if useCustomTitleBar is false (using system decorations)
* Determine if the title bar should be visible
*/
export function shouldShowTitleBar(): boolean {
if (hideTitleBar) return false;
return useCustomTitleBar;
return !hideTitleBar;
}
/**
@@ -83,53 +63,16 @@ export function shouldShowTitleBar(): boolean {
* Returns 0 if title bar is hidden, 32 otherwise
*/
export function getTitleBarHeight(): number {
return shouldShowTitleBar() ? 32 : 0;
}
/**
* 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();
return hideTitleBar ? 0 : 32;
}
/**
* Set whether to hide title bar completely
*/
export async function setHideTitleBar(value: boolean): Promise<void> {
export function setHideTitleBar(value: boolean): void {
hideTitleBar = value;
try {
localStorage.setItem(STORAGE_KEY_HIDE, String(value));
await applyTitleBarSettings();
} catch (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 {
useCustomTitleBar: boolean;
hideTitleBar: boolean;
showTitleBar: boolean;
titleBarHeight: number;
@@ -145,7 +87,6 @@ export interface TitleBarState {
export function getTitleBarState(): TitleBarState {
return {
useCustomTitleBar,
hideTitleBar,
showTitleBar: shouldShowTitleBar(),
titleBarHeight: getTitleBarHeight()
-1
View File
@@ -75,7 +75,6 @@
import {
subscribe as subscribeTitleBar,
initTitleBarStore,
getTitleBarState,
shouldShowTitleBar
} from '$lib/stores/titleBarStore';