summaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-30 16:51:50 +0100
committertcmal <me@aria.rip>2024-08-30 17:10:47 +0100
commit8fc827a3b30de16b6adbf80abea3bc224d507268 (patch)
treec9a37a1dbaf02ec3b52000b5feaa3cba6af511ef /src/clients
parenta568b4a79d1ccabfdff0a5a8ecbb908e96f17cf5 (diff)
Add bind for going back and forth between tags
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/mod.rs6
-rw-r--r--src/clients/monitors.rs4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs
index 70ffb00..d093fb1 100644
--- a/src/clients/mod.rs
+++ b/src/clients/mod.rs
@@ -432,11 +432,17 @@ impl ClientState {
.for_each(|c| c.ensure_unmapped(conn));
debug!("setting tag focus to {:?} on mon {}", tag_focus, mon);
+ self.mons[mon].last_focused_tag = curr_focus;
self.mons[mon].focused_tag = tag_focus;
self.unfocus(conn);
self.rearrange_mon(conn, mon);
}
+ /// Set the given monitor's focused tag to its previous value
+ pub fn mon_prev_tag_focus(&mut self, conn: &Connection<'_>, mon: MonitorIdx) {
+ self.set_mon_tag_focus(conn, mon, self.mons[mon].last_focused_tag);
+ }
+
/// Set the tag for the given client
pub fn set_client_tag(&mut self, conn: &Connection<'_>, pos: ClientIdx, tag: Tag) {
let c = self.client_mut(pos);
diff --git a/src/clients/monitors.rs b/src/clients/monitors.rs
index c828fbd..ba59772 100644
--- a/src/clients/monitors.rs
+++ b/src/clients/monitors.rs
@@ -8,6 +8,9 @@ pub struct MonitorInfo {
/// How clients should be filtered by tag
pub focused_tag: TagFocus,
+ /// The previously focused tag, for going back-and-forth
+ pub last_focused_tag: TagFocus,
+
/// The monitor's geometry
pub screen_info: MonitorGeometry,
}
@@ -60,6 +63,7 @@ impl Default for MonitorInfo {
height: 0,
},
focused_tag: TagFocus::Tag(1),
+ last_focused_tag: TagFocus::Tag(1),
}
}
}