feat(appearance): match system window chrome (phase 1) + ribbon cleanup
Adds an opt-in "Match system window chrome" toggle in Settings >
Appearance. When enabled (and the custom title bar is active, i.e.
neither "Use system title bar" nor "Hide title bar"), QBZ rounds its
own corners to match the detected desktop's decoration radius and
paints a thin edge outline so the window reads as its own surface
against the desktop instead of a bare rectangle.
Phase 1 scope:
* New windowChromeStore (localStorage) holding the toggle and the
detected corner radius.
* desktop_theme module gains a best-effort window_corner_radius_px:
10 for Klassy, 6 for Breeze Plasma, 12 for GNOME/Adwaita, 8 fallback.
* +page.svelte subscribes to the detector; .app.match-chrome.floating
applies the radius via a CSS variable plus a 1px darkening outline
and a deeper shadow. Maximized state removes the radius.
* SettingsView: new toggle, disabled when hideTitleBar or
useSystemTitleBar is on; i18n for en/es.
External shadow that matches each DE's compositor remains a phase 2
item — it requires `transparent: true` on the Tauri window, which has
compositor stability trade-offs and must be restart-gated.
Also cleans up redundant AlbumCard ribbons in the Editor's Picks
TAB (distinct from the home tab that was fixed earlier): removes
ribbon={album.ribbon} from the `editorPicks` and `qobuzissimes`
sections inside the editor-picks tab block. Press Accolades and
Popular Albums keep their ribbons (they vary per card).
cc
This commit is contained in:
1 parent
62d1674673
commit
8502c2fdb3
8 files changed
+162
-5
No files matched your search
@@ -23,6 +23,10 @@ pub struct DesktopThemeInfo {
|
||||
pub klassy_button_icon_style: Option<String>,
|
||||
pub klassy_button_shape: Option<String>,
|
||||
pub klassy_match_app_color: Option<bool>,
|
||||
/// Best-effort default corner radius for the active desktop, in px.
|
||||
/// Used by the "match system window chrome" feature to approximate
|
||||
/// the decoration radius without transparent-window trickery.
|
||||
pub window_corner_radius_px: u16,
|
||||
}
|
||||
|
||||
/// Parse a `R,G,B` KDE color triplet into a `#rrggbb` hex string. Accepts
|
||||
@@ -63,10 +67,25 @@ fn ini_get(path: &std::path::Path, section: &str, key: &str) -> Option<String> {
|
||||
|
||||
/// Return a best-effort snapshot of the user's desktop decoration theme.
|
||||
/// Non-Plasma desktops yield `desktop="other"` with everything else `None`.
|
||||
/// Best-effort default window corner radius for a detected desktop.
|
||||
/// Plasma/Klassy leans to ~10px, Breeze to ~4px, GNOME/Adwaita to ~12px.
|
||||
/// Conservative for unknown desktops.
|
||||
fn default_corner_radius(desktop: &str, is_klassy: bool) -> u16 {
|
||||
if is_klassy {
|
||||
return 10;
|
||||
}
|
||||
match desktop {
|
||||
"plasma-breeze" => 6,
|
||||
"gnome" => 12,
|
||||
_ => 8,
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn detect_desktop_theme() -> DesktopThemeInfo {
|
||||
let mut info = DesktopThemeInfo {
|
||||
desktop: "other".to_string(),
|
||||
window_corner_radius_px: 8,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -103,6 +122,8 @@ pub fn detect_desktop_theme() -> DesktopThemeInfo {
|
||||
.map(|v| v.eq_ignore_ascii_case("true") || v.starts_with('1'));
|
||||
}
|
||||
|
||||
info.window_corner_radius_px = default_corner_radius(&info.desktop, info.is_klassy);
|
||||
|
||||
info.titlebar_active_bg = ini_get(&kdeglobals, "WM", "activeBackground").and_then(|v| kde_color_to_hex(&v));
|
||||
info.titlebar_active_fg = ini_get(&kdeglobals, "WM", "activeForeground").and_then(|v| kde_color_to_hex(&v));
|
||||
info.titlebar_inactive_bg = ini_get(&kdeglobals, "WM", "inactiveBackground").and_then(|v| kde_color_to_hex(&v));
|
||||
|
||||
Reference in new issue
Block a user