From 23f72eff3d48676bd89ce1a70e00f67842ff49a7 Mon Sep 17 00:00:00 2001 From: Denis Defolie Date: Fri, 30 Oct 2026 09:12:17 +0100 Subject: [PATCH] Replace an already-open settings window instead of ignoring the request When the settings window was open but buried under other windows, asking for it again from the tray did nothing, so it could not be reached. Asking the existing window to rise only makes the taskbar entry blink under KWin (focus-stealing prevention), so the daemon now closes it and opens a fresh one, which always appears on top. Settings are saved as they change. Co-Authored-By: Claude Sonnet 5.5 --- CLAUDE.md | 1 + src/core.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d222f15..5cf9b68 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,6 +43,7 @@ Adding a config option touches: `config.rs` (struct, `Default`, `sanitize`), `i1 - tiny-skia: `fill_rect` with a transform or anti-aliasing falls off its fast path (use `fx::fill_rect_fast`); `Rect::from_ltrb` accepts zero width and then fills a 1 px sliver; anti-aliasing is not perfectly translation-invariant (hence the tolerance in the canvas property test). - evdev codes + 8 = xkb/X keycodes. The `wl_keyboard` keymap fd shares its file offset with the compositor: read it with `read_exact_at(.., 0)`. - **egui ids must be unique on screen.** Two `ComboBox`es sharing an id (e.g. both labelled "Style") act as one control and their popups close each other, so the lists could not be opened. `combo()` in `settings.rs` takes an explicit id — never derive it from the label. `examples/click_at.rs` drives the real settings window through XTEST for such checks (it refuses to click unless the pointer is over our own window). +- **Raising an already-open settings window does not work under KWin.** Focus-stealing prevention turns another process's activation request (`ViewportCommand::Focus` after a `SIGUSR1`) into a blinking taskbar entry (`_NET_WM_STATE_DEMANDS_ATTENTION`), so a window buried under others stays buried. `Core::open_settings` therefore kills the old child and spawns a new one, which always maps on top. It is safe because the settings save as they change. - Process name `sourizz-settings` is truncated to 15 chars by the kernel: use `pgrep -x sourizz-setting`, and never `pgrep -f` from a shell whose own command line contains the pattern. ## Testing Wayland without a Wayland session diff --git a/src/core.rs b/src/core.rs index 2c0b25a..a5b9daa 100644 --- a/src/core.rs +++ b/src/core.rs @@ -181,10 +181,12 @@ impl Core { } fn open_settings(&mut self) { - if let Some(c) = &mut self.settings { - if matches!(c.try_wait(), Ok(None)) { - return; // already open - } + // A window that is still open may be buried under others, and KWin's focus-stealing prevention + // only makes the taskbar entry blink when another process asks it to rise: replace it with a + // fresh one, which always appears on top. The settings are saved as they change. + if let Some(mut c) = self.settings.take() { + let _ = c.kill(); + let _ = c.wait(); } let sibling = std::env::current_exe().ok().map(|p| p.with_file_name("sourizz-settings")).filter(|p| p.is_file()); let program = sibling.unwrap_or_else(|| "sourizz-settings".into());