From 8d7b22d1a8968a46286fdd13ca9d8d2c88e10e48 Mon Sep 17 00:00:00 2001 From: sashomasho Date: Wed, 11 Jun 2025 09:05:14 +0300 Subject: Add deactivate-unfocused-windows debug flag (#1706) * force xdg deactivation on invisable workspaces This debug option provides a workaround for many Chromium-based chat applications that fail to show notifications when they're active in a workspace that's not currently visible and don't have keyboard focus Signed-off-by: Alex Yosifov * fixes --------- Signed-off-by: Alex Yosifov Co-authored-by: Ivan Molodetskikh --- src/layout/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/layout/mod.rs') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 9b0002e0..5deda707 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -361,6 +361,7 @@ pub struct Options { // Debug flags. pub disable_resize_throttling: bool, pub disable_transactions: bool, + pub deactivate_unfocused_windows: bool, } impl Default for Options { @@ -393,6 +394,7 @@ impl Default for Options { PresetSize::Proportion(0.5), PresetSize::Proportion(2. / 3.), ], + deactivate_unfocused_windows: false, } } } @@ -658,6 +660,7 @@ impl Options { overview: config.overview, disable_resize_throttling: config.debug.disable_resize_throttling, disable_transactions: config.debug.disable_transactions, + deactivate_unfocused_windows: config.debug.deactivate_unfocused_windows, preset_window_heights, } } @@ -5124,7 +5127,8 @@ impl Layout { } for (ws_idx, ws) in mon.workspaces.iter_mut().enumerate() { - ws.refresh(is_active); + let is_focused = is_active && ws_idx == mon.active_workspace_idx; + ws.refresh(is_active, is_focused); if let Some(is_scrolling) = ongoing_scrolling_dnd { // Lock or unlock the view for scrolling interactive move. @@ -5144,7 +5148,7 @@ impl Layout { } MonitorSet::NoOutputs { workspaces, .. } => { for ws in workspaces { - ws.refresh(false); + ws.refresh(false, false); ws.view_offset_gesture_end(None); } } -- cgit