fix(titlebar): hide stripped strip in plasma when empty
If the user has search-in-titlebar off AND no titlebar-nav items enabled, plasma mode would render an empty 42px strip below the KWin SSD. Gate shouldShowTitleBar() in plasma on whether either is enabled. +page.svelte's search-location and titlebar-nav subscriptions now also recompute showTitleBar so the layout reflows immediately when the user toggles those settings. cc
This commit is contained in:
2 files changed
+20
-2
No files matched your search
@@ -14,6 +14,8 @@
|
|||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { skipIfRemote } from '$lib/services/commandRouter';
|
import { skipIfRemote } from '$lib/services/commandRouter';
|
||||||
import { platform } from '$lib/utils/platform';
|
import { platform } from '$lib/utils/platform';
|
||||||
|
import { getSearchBarLocation } from './searchBarLocationStore';
|
||||||
|
import { isTitlebarNavEnabled } from './titlebarNavStore';
|
||||||
|
|
||||||
export type TitlebarMode = 'qbz' | 'system' | 'plasma' | 'hidden';
|
export type TitlebarMode = 'qbz' | 'system' | 'plasma' | 'hidden';
|
||||||
|
|
||||||
@@ -89,12 +91,20 @@ export function getMode(): TitlebarMode {
|
|||||||
/**
|
/**
|
||||||
* Whether the custom TitleBar.svelte component should mount.
|
* Whether the custom TitleBar.svelte component should mount.
|
||||||
* - macOS always uses native overlay → false.
|
* - macOS always uses native overlay → false.
|
||||||
* - 'qbz' and 'plasma' → true (full or stripped variant).
|
* - 'qbz' → true (full variant).
|
||||||
|
* - 'plasma' → true ONLY if the stripped strip would carry content
|
||||||
|
* (search-in-titlebar OR at least one nav item). Otherwise the
|
||||||
|
* 42px strip would render empty below the KWin SSD.
|
||||||
* - 'system' and 'hidden' → false.
|
* - 'system' and 'hidden' → false.
|
||||||
*/
|
*/
|
||||||
export function shouldShowTitleBar(): boolean {
|
export function shouldShowTitleBar(): boolean {
|
||||||
if (platform === 'macos') return false;
|
if (platform === 'macos') return false;
|
||||||
return mode === 'qbz' || mode === 'plasma';
|
if (mode === 'system' || mode === 'hidden') return false;
|
||||||
|
if (mode === 'qbz') return true;
|
||||||
|
// mode === 'plasma' — only render the strip if it has effective content.
|
||||||
|
// (In plasma, the effective values for search location and titlebar nav
|
||||||
|
// match the user prefs directly per the derived-state table.)
|
||||||
|
return getSearchBarLocation() === 'titlebar' || isTitlebarNavEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4848,6 +4848,10 @@
|
|||||||
initSearchBarLocation();
|
initSearchBarLocation();
|
||||||
const unsubscribeSearchBarLocation = subscribeSearchBarLocation(() => {
|
const unsubscribeSearchBarLocation = subscribeSearchBarLocation(() => {
|
||||||
searchBarLocationPref = getEffectiveSearchBarLocation();
|
searchBarLocationPref = getEffectiveSearchBarLocation();
|
||||||
|
// In plasma mode the strip's visibility depends on whether search
|
||||||
|
// or any nav item is enabled, so a search-location toggle can flip
|
||||||
|
// the strip on/off.
|
||||||
|
showTitleBar = shouldShowTitleBar();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize and subscribe to window controls customization
|
// Initialize and subscribe to window controls customization
|
||||||
@@ -4868,6 +4872,10 @@
|
|||||||
tbNavLibrary = isLibraryInTitlebar();
|
tbNavLibrary = isLibraryInTitlebar();
|
||||||
tbNavMyQbz = isMyQbzInTitlebar();
|
tbNavMyQbz = isMyQbzInTitlebar();
|
||||||
tbNavPurchases = isPurchasesInTitlebar();
|
tbNavPurchases = isPurchasesInTitlebar();
|
||||||
|
// In plasma mode the strip's visibility depends on whether any nav
|
||||||
|
// item or search is enabled, so toggling the last nav item can
|
||||||
|
// flip the strip on/off.
|
||||||
|
showTitleBar = shouldShowTitleBar();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Detect floating window state (not maximized) for rounded corners + shadow
|
// Detect floating window state (not maximized) for rounded corners + shadow
|
||||||
|
|||||||
Reference in new issue
Block a user