forge
Explore
Log in

Don't you dare go Hollow

Add is-urgent window rule matcher

Browse files at this commit

a2efaf2816f14ea437d88bc6b9253b1e347c4ceeIvan MolodetskikhParent: 5816691
niri-config/src/lib.rsmodified+5 -0
@@ -1457,6 +1457,8 @@ pub struct Match {
14571457 #[knuffel(property)]
14581458 pub is_window_cast_target: Option<bool>,
14591459 #[knuffel(property)]
1460+ pub is_urgent: Option<bool>,
1461+ #[knuffel(property)]
14601462 pub at_startup: Option<bool>,
14611463 }
14621464
@@ -4804,6 +4806,7 @@ mod tests {
48044806 is_active_in_column: None,
48054807 is_floating: None,
48064808 is_window_cast_target: None,
4809+ is_urgent: None,
48074810 at_startup: None,
48084811 },
48094812 ],
@@ -4822,6 +4825,7 @@ mod tests {
48224825 is_active_in_column: None,
48234826 is_floating: None,
48244827 is_window_cast_target: None,
4828+ is_urgent: None,
48254829 at_startup: None,
48264830 },
48274831 Match {
@@ -4836,6 +4840,7 @@ mod tests {
48364840 is_active_in_column: None,
48374841 is_floating: None,
48384842 is_window_cast_target: None,
4843+ is_urgent: None,
48394844 at_startup: None,
48404845 },
48414846 ],
src/window/mapped.rsmodified+1 -0
@@ -520,6 +520,7 @@ impl Mapped {
520520 if self.is_focused && urgent {
521521 return;
522522 }
523+
523524 let changed = self.is_urgent != urgent;
524525 self.is_urgent = urgent;
525526 self.need_to_recompute_rules |= changed;
src/window/mod.rsmodified+6 -0
@@ -440,6 +440,12 @@ fn window_matches(window: WindowRef, role: &XdgToplevelSurfaceRoleAttributes, m:
440440 }
441441 }
442442
443+ if let Some(is_urgent) = m.is_urgent {
444+ if window.is_urgent() != is_urgent {
445+ return false;
446+ }
447+ }
448+
443449 if let Some(is_active) = m.is_active {
444450 // Our "is-active" definition corresponds to the window having a pending Activated state.
445451 let pending_activated = server_pending
wiki/Configuration:-Window-Rules.mdmodified+14 -0
@@ -35,6 +35,7 @@ window-rule {
3535 match is-active-in-column=true
3636 match is-floating=true
3737 match is-window-cast-target=true
38+ match is-urgent=true
3839 match at-startup=true
3940
4041 // Properties that apply once upon window opening.
@@ -286,6 +287,19 @@ Example:
286287
287288 ![](https://github.com/user-attachments/assets/375b381e-3a87-4e94-8676-44404971d893)
288289
290+#### `is-urgent`
291+
292+<sup>Since: next release</sup>
293+
294+Can be `true` or `false`.
295+Matches windows that request the user's attention.
296+
297+```kdl
298+window-rule {
299+ match is-urgent=true
300+}
301+```
302+
289303 #### `at-startup`
290304
291305 <sup>Since: 0.1.6</sup>