Commit 5ab6f980c72f
tarball2 files changed+24-0
@@ -250,6 +250,27 @@ impl Layout {
250250
}251251
}252252
253
+ /// Brings `w`'s tag into view beside the others when `w` is the only254
+ /// window on it there.255
+ pub fn view_if_alone(&mut self, w: WindowId) {256
+ let Some(win) = self.windows.get(w) else {257
+ return;258
+ };259
+ let (Some(o), tag) = (win.output, win.tag) else {260
+ return;261
+ };262
+ if win.scratchpad.is_some() || self.is_viewed(o, tag) {263
+ return;264
+ }265
+ let alone = !self266
+ .windows267
+ .iter()268
+ .any(|(x, v)| x != w && v.output == Some(o) && v.tag == tag && v.scratchpad.is_none());269
+ if alone {270
+ self.toggle_view(o, tag);271
+ }272
+ }273
+253274
/// The tag a launch from `o` belongs to. The focused window's tag, else254275
/// the first viewed tag, else homeless. Homeless is always on screen, so255276
/// focusing one of its windows does not mean the user left their tag.@@ -60,6 +60,9 @@ impl State {
6060
if let Some(name) = &rule.scratchpad {6161
self.wm.layout.scratchpad_add(id, name);6262
}63
+ if self.settings.config.general.view_tag_on_first_window {64
+ self.wm.layout.view_if_alone(id);65
+ }6366
let by_rule = rule.tag.is_some() || rule.output.is_some();6467
self.wm.insert(id, window, by_rule, app_id, title);6568
self.await_first_buffer(id);