From 1f708f8aa09bf8bbce82314a76b7f34def90b798 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sat, 31 Jan 2026 14:34:00 +0200 Subject: Fix desktop-icon deselection and workspace-teleport-on-close; document a shadow limit Desktop icons stayed highlighted after clicking a window: select_desktop_icon(None) was only ever called from start_desktop_marquee, never from the one place every focus path (click, Alt-Tab, dock IPC, scratchpad show, snap flyout) already funnels through. Added the deselect there instead of per-caller. Closing a focused window could silently switch the user's active workspace: remove_window's fallback picked self.order.last(), but that list is global, not per-workspace, so it could land on a background window elsewhere - and focus_window already switches workspace to match whatever it's given (a real, separate feature for a deliberate srd dispatch focus). Fixed by preferring a same-workspace window first. New general.close_focus_follows_workspace (default false, live-settable) controls what happens only when nothing is left on the current workspace at all: off leaves focus at nothing, matching Windows/GNOME/macOS; on restores the old always-follow-the-global-fallback behaviour. Three new tests. Also documented, not fixed: shadows can still bleed onto a neighbouring *monitor* near a multi-output seam (shadow_rect has no monitor-boundary awareness), found via a live cross-monitor screenshot. Moot for this session since general.shadows is already off in the live config, but a real, open gap for anyone who re-enables shadows on a multi-monitor setup. --- crates/platform/src/ipc/dispatch.rs | 12 ++++++++++++ crates/platform/src/ipc/types.rs | 1 + 2 files changed, 13 insertions(+) (limited to 'crates/platform/src') diff --git a/crates/platform/src/ipc/dispatch.rs b/crates/platform/src/ipc/dispatch.rs index c5e70be..5668d14 100644 --- a/crates/platform/src/ipc/dispatch.rs +++ b/crates/platform/src/ipc/dispatch.rs @@ -22,6 +22,7 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc` - live equivalent + // of `general.close_focus_follows_workspace`. See `WindowManager:: + // close_focus_follows_workspace`'s own doc comment for what this + // actually gates: whether closing your focused window is allowed + // to fall back to (and switch your active workspace to follow) a + // window elsewhere, when nothing else is left on your current one. + "close_focus_follows_workspace" => { + let Some(v) = value.and_then(|v| v.as_bool()) else { return (err("close_focus_follows_workspace needs a boolean value"), false) }; + wm.borrow_mut().close_focus_follows_workspace = v; + (ok(), true) + } // A bool, not a radius: the actual corner radius is a fixed // constant (`crates/wayland/src/decoration.rs::CORNER_RADIUS`), // not a per-session config value anywhere in the compositor yet -- diff --git a/crates/platform/src/ipc/types.rs b/crates/platform/src/ipc/types.rs index bf1526e..095dc3d 100644 --- a/crates/platform/src/ipc/types.rs +++ b/crates/platform/src/ipc/types.rs @@ -158,6 +158,7 @@ pub(crate) struct PinnedInputsResponse { #[derive(Serialize)] pub(crate) struct SettingsResponse { pub(crate) shadows: bool, + pub(crate) close_focus_follows_workspace: bool, pub(crate) rounded_corners: Option, pub(crate) animations: bool, pub(crate) night_light: bool, -- cgit v1.2.3