mirror of
https://github.com/deunix-educ/sourizz.git
synced 2026-11-25 04:39:43 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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).
|
- 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)`.
|
- 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).
|
- **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.
|
- 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
|
## Testing Wayland without a Wayland session
|
||||||
|
|||||||
+6
-4
@@ -181,10 +181,12 @@ impl Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open_settings(&mut self) {
|
fn open_settings(&mut self) {
|
||||||
if let Some(c) = &mut self.settings {
|
// A window that is still open may be buried under others, and KWin's focus-stealing prevention
|
||||||
if matches!(c.try_wait(), Ok(None)) {
|
// only makes the taskbar entry blink when another process asks it to rise: replace it with a
|
||||||
return; // already open
|
// 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 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());
|
let program = sibling.unwrap_or_else(|| "sourizz-settings".into());
|
||||||
|
|||||||
Reference in New Issue
Block a user