summaryrefslogtreecommitdiff
path: root/src/clients/mod.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-30 14:35:31 +0100
committertcmal <me@aria.rip>2024-08-30 15:11:56 +0100
commitd2506fbbee01e26f8decd0ce2371e674086c4300 (patch)
treeb89d1612503058e0d99498505357b2836e12f9ec /src/clients/mod.rs
parent435e24753b31de31d28a70ea275f7b68d200b10d (diff)
Switch workspace as needed when refocusing
Diffstat (limited to 'src/clients/mod.rs')
-rw-r--r--src/clients/mod.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs
index dcce37a..6481c0f 100644
--- a/src/clients/mod.rs
+++ b/src/clients/mod.rs
@@ -124,6 +124,7 @@ impl WM<'_> {
// The above may fail if the window has already been destroyed - just discard the error here.
let _ = self.conn.check_request(cookie);
}
+
if self
.clients
.focused()
@@ -233,9 +234,17 @@ impl ClientState {
/// If the given index is invalid, focus on the root instead.
pub fn refocus(&mut self, conn: &Connection<'_>, i: ClientIdx) {
self.unfocus(conn);
- if let Some(new) = self.set_focused(i) {
+ if self.set_focused(i).is_some() {
+ let mon_idx = self.client_mon_idx(i);
+ let tag = self.client(i).tag;
+ if !self.mons[mon_idx].focused_tag.matches(tag) {
+ self.set_mon_tag_focus(conn, mon_idx, TagFocus::Tag(tag));
+ }
+
+ let new = self.client_mut(i);
new.set_border(conn, conn.colours.border_focused());
new.sync_hints(conn, true);
+
buttons::grab(conn, new.window(), true);
if !new.never_focus() {
conn.send_request(&SetInputFocus {
@@ -252,7 +261,6 @@ impl ClientState {
});
conn.send_event(new.window(), conn.atoms.wm_take_focus);
}
- // TODO: Update focused tag
} else {
conn.send_request(&SetInputFocus {
revert_to: InputFocus::PointerRoot,
@@ -475,7 +483,6 @@ impl ClientState {
self.focused_client.map(|i| self.client_mut(i))
}
- /// Get the position of the currently focused client. This position may be invalid.
pub fn is_focused(&self, e: Window) -> bool {
self.focused().is_some_and(|c| c.window() == e)
}