aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/layout/floating.rs7
-rw-r--r--src/layout/mod.rs8
-rw-r--r--src/layout/scrolling.rs11
-rw-r--r--src/layout/workspace.rs6
4 files changed, 21 insertions, 11 deletions
diff --git a/src/layout/floating.rs b/src/layout/floating.rs
index 7d7e7fc0..98927c0d 100644
--- a/src/layout/floating.rs
+++ b/src/layout/floating.rs
@@ -1090,7 +1090,7 @@ impl<W: LayoutElement> FloatingSpace<W> {
self.interactive_resize = None;
}
- pub fn refresh(&mut self, is_active: bool) {
+ pub fn refresh(&mut self, is_active: bool, is_focused: bool) {
let active = self.active_window_id.clone();
for tile in &mut self.tiles {
let win = tile.window_mut();
@@ -1098,7 +1098,10 @@ impl<W: LayoutElement> FloatingSpace<W> {
win.set_active_in_column(true);
win.set_floating(true);
- let is_active = is_active && Some(win.id()) == active.as_ref();
+ let mut is_active = is_active && Some(win.id()) == active.as_ref();
+ if self.options.deactivate_unfocused_windows {
+ is_active &= is_focused;
+ }
win.set_activated(is_active);
let resize_data = self
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<W: LayoutElement> Layout<W> {
}
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<W: LayoutElement> Layout<W> {
}
MonitorSet::NoOutputs { workspaces, .. } => {
for ws in workspaces {
- ws.refresh(false);
+ ws.refresh(false, false);
ws.view_offset_gesture_end(None);
}
}
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index 1b4d91c5..0c70fc7a 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -3458,7 +3458,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
self.interactive_resize = None;
}
- pub fn refresh(&mut self, is_active: bool) {
+ pub fn refresh(&mut self, is_active: bool, is_focused: bool) {
for (col_idx, col) in self.columns.iter_mut().enumerate() {
let mut col_resize_data = None;
if let Some(resize) = &self.interactive_resize {
@@ -3503,11 +3503,14 @@ impl<W: LayoutElement> ScrollingSpace<W> {
win.set_active_in_column(active_in_column);
win.set_floating(false);
- let active = is_active
- && self.active_column_idx == col_idx
+ let mut active = is_active && self.active_column_idx == col_idx;
+ if self.options.deactivate_unfocused_windows {
+ active &= active_in_column && is_focused;
+ } else {
// In tabbed mode, all tabs have activated state to reduce unnecessary
// animations when switching tabs.
- && (active_in_column || is_tabbed);
+ active &= active_in_column || is_tabbed;
+ }
win.set_activated(active);
win.set_interactive_resize(col_resize_data);
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 3f5a07c5..588a6971 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -1600,11 +1600,11 @@ impl<W: LayoutElement> Workspace<W> {
}
}
- pub fn refresh(&mut self, is_active: bool) {
+ pub fn refresh(&mut self, is_active: bool, is_focused: bool) {
self.scrolling
- .refresh(is_active && !self.floating_is_active.get());
+ .refresh(is_active && !self.floating_is_active.get(), is_focused);
self.floating
- .refresh(is_active && self.floating_is_active.get());
+ .refresh(is_active && self.floating_is_active.get(), is_focused);
}
pub fn scroll_amount_to_activate(&self, window: &W::Id) -> f64 {