From 76031dd8809701e39d3709451809851ad063bf73 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sat, 31 Jan 2026 14:21:00 +0200 Subject: Fix zathura's double titlebar by broadening the CSD-detection heuristic Reported live, found via a screenshot of the user's real open window: srdwm's own server-side titlebar stacked on top of zathura's own girara-drawn header, same class of bug Firefox/Nemo needed a fix for. likely_draws_own_titlebar only matched org.gnome.* app ids; zathura's app id (org.pwmt.zathura) fell through it entirely, with no rules.lua entry to catch it either. Broadened the heuristic to also match org.pwmt.* - PWMT's small toolset (zathura the only one in common use) shares GNOME's own "always draws its own header" property, on the same live evidence that justified org.gnome.* in the first place. No rules.lua entry needed; the heuristic catches it automatically now. Reproduced and confirmed fixed in a disposable nested compositor (built, tested double-decoration, then rebuilt with the fix and retested clean) - never the live session itself. --- crates/core/src/window.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'crates/core/src') diff --git a/crates/core/src/window.rs b/crates/core/src/window.rs index cc841b1..a3d48a2 100644 --- a/crates/core/src/window.rs +++ b/crates/core/src/window.rs @@ -140,8 +140,18 @@ pub fn classify_menu_source(gtk_menu_path: Option, is_real_gtk_applicati /// GNOME's HIG mandate, so guessing from the app id alone there would /// misclassify plenty of ordinary, well-behaved server-side-decorated apps /// that also happen to use a reverse-DNS-style id. +/// +/// `org.pwmt.*` added the same way, on the same evidence: zathura +/// (`org.pwmt.zathura`) reported live as a double titlebar - confirmed in +/// a nested compositor, screenshotted, two stacked rows with visibly +/// different button styles (srdwm's own configured style on top, zathura's +/// own girara-drawn row underneath). PWMT's own small set of tools (girara- +/// based, zathura being the only one in common use) all share the same +/// always-draws-its-own-header behaviour Firefox/Nemo needed a rule for, +/// so the namespace is as safe a bet here as GNOME's own. pub fn likely_draws_own_titlebar(app_id: &str) -> bool { - app_id.to_ascii_lowercase().starts_with("org.gnome.") + let app_id = app_id.to_ascii_lowercase(); + app_id.starts_with("org.gnome.") || app_id.starts_with("org.pwmt.") } /// State of a single managed window. This is platform-independent: backends @@ -930,6 +940,22 @@ mod button_order_tests { mod tests { use super::*; + #[test] + fn likely_draws_own_titlebar_matches_both_known_namespaces_case_insensitively() { + assert!(likely_draws_own_titlebar("org.gnome.Nautilus")); + assert!(likely_draws_own_titlebar("ORG.GNOME.TextEditor")); + assert!(likely_draws_own_titlebar("org.pwmt.zathura")); + assert!(likely_draws_own_titlebar("Org.Pwmt.Zathura")); + } + + #[test] + fn likely_draws_own_titlebar_does_not_misclassify_unrelated_reverse_dns_ids() { + assert!(!likely_draws_own_titlebar("io.github.somebody.SomeApp")); + assert!(!likely_draws_own_titlebar("org.mozilla.firefox")); + assert!(!likely_draws_own_titlebar("firefox")); + assert!(!likely_draws_own_titlebar("")); + } + fn frame() -> Rect { Rect::new(100, 100, 400, 300) } -- cgit v1.2.3