aboutsummaryrefslogtreecommitdiff
path: root/src/window/mapped.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-23 16:16:52 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-23 16:16:52 +0400
commit6ec65bc0d6f6141a3951c076b693b6ce430c503a (patch)
tree3c601ca9310357935f1c95066797571fcc5a797d /src/window/mapped.rs
parentd65446421fb989c74329b053fd3ccc387403fdc5 (diff)
downloadniri-6ec65bc0d6f6141a3951c076b693b6ce430c503a.tar.gz
niri-6ec65bc0d6f6141a3951c076b693b6ce430c503a.tar.bz2
niri-6ec65bc0d6f6141a3951c076b693b6ce430c503a.zip
Add is-focused window rule matcher
Diffstat (limited to 'src/window/mapped.rs')
-rw-r--r--src/window/mapped.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index 087bf0e7..a48ca636 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -29,6 +29,9 @@ pub struct Mapped {
/// This is not used in all cases; for example, app ID and title changes recompute the rules
/// immediately, rather than setting this flag.
need_to_recompute_rules: bool,
+
+ /// Whether this window has the keyboard focus.
+ is_focused: bool,
}
impl Mapped {
@@ -37,6 +40,7 @@ impl Mapped {
window,
rules,
need_to_recompute_rules: false,
+ is_focused: false,
}
}
@@ -64,6 +68,19 @@ impl Mapped {
self.recompute_window_rules(rules)
}
+
+ pub fn is_focused(&self) -> bool {
+ self.is_focused
+ }
+
+ pub fn set_is_focused(&mut self, is_focused: bool) {
+ if self.is_focused == is_focused {
+ return;
+ }
+
+ self.is_focused = is_focused;
+ self.need_to_recompute_rules = true;
+ }
}
impl LayoutElement for Mapped {