srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/platform/src
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-01-31 14:34:00 +0200
committersrdusr <[email protected]>2026-01-31 14:34:00 +0200
commit1f708f8aa09bf8bbce82314a76b7f34def90b798 (patch)
tree3ca6468dc0507f563147cbeb4d8b7e9a40949921 /crates/platform/src
parent76031dd8809701e39d3709451809851ad063bf73 (diff)
downloadsrdwm-1f708f8aa09bf8bbce82314a76b7f34def90b798.tar.gz
srdwm-1f708f8aa09bf8bbce82314a76b7f34def90b798.zip
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.
Diffstat (limited to 'crates/platform/src')
-rw-r--r--crates/platform/src/ipc/dispatch.rs12
-rw-r--r--crates/platform/src/ipc/types.rs1
2 files changed, 13 insertions, 0 deletions
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<std::cell::RefCell<Wi
let wm = wm.borrow();
let settings = SettingsResponse {
shadows: wm.shadows_enabled,
+ close_focus_follows_workspace: wm.close_focus_follows_workspace,
rounded_corners: wm.rounded_corners_enabled,
animations: wm.animations_enabled,
night_light: wm.color_filter == srdwm_core::ColorFilter::NightLight,
@@ -636,6 +637,17 @@ fn handle_set(req: &serde_json::Value, wm: &std::rc::Rc<std::cell::RefCell<Windo
wm.borrow_mut().shadows_enabled = v;
(ok(), true)
}
+ // `srd set close_focus_follows_workspace <bool>` - 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<bool>,
pub(crate) animations: bool,
pub(crate) night_light: bool,