mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Add is-urgent window rule matcher
This commit is contained in:
@@ -1457,6 +1457,8 @@ pub struct Match {
|
||||
#[knuffel(property)]
|
||||
pub is_window_cast_target: Option<bool>,
|
||||
#[knuffel(property)]
|
||||
pub is_urgent: Option<bool>,
|
||||
#[knuffel(property)]
|
||||
pub at_startup: Option<bool>,
|
||||
}
|
||||
|
||||
@@ -4804,6 +4806,7 @@ mod tests {
|
||||
is_active_in_column: None,
|
||||
is_floating: None,
|
||||
is_window_cast_target: None,
|
||||
is_urgent: None,
|
||||
at_startup: None,
|
||||
},
|
||||
],
|
||||
@@ -4822,6 +4825,7 @@ mod tests {
|
||||
is_active_in_column: None,
|
||||
is_floating: None,
|
||||
is_window_cast_target: None,
|
||||
is_urgent: None,
|
||||
at_startup: None,
|
||||
},
|
||||
Match {
|
||||
@@ -4836,6 +4840,7 @@ mod tests {
|
||||
is_active_in_column: None,
|
||||
is_floating: None,
|
||||
is_window_cast_target: None,
|
||||
is_urgent: None,
|
||||
at_startup: None,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -520,6 +520,7 @@ impl Mapped {
|
||||
if self.is_focused && urgent {
|
||||
return;
|
||||
}
|
||||
|
||||
let changed = self.is_urgent != urgent;
|
||||
self.is_urgent = urgent;
|
||||
self.need_to_recompute_rules |= changed;
|
||||
|
||||
@@ -440,6 +440,12 @@ fn window_matches(window: WindowRef, role: &XdgToplevelSurfaceRoleAttributes, m:
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(is_urgent) = m.is_urgent {
|
||||
if window.is_urgent() != is_urgent {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(is_active) = m.is_active {
|
||||
// Our "is-active" definition corresponds to the window having a pending Activated state.
|
||||
let pending_activated = server_pending
|
||||
|
||||
@@ -35,6 +35,7 @@ window-rule {
|
||||
match is-active-in-column=true
|
||||
match is-floating=true
|
||||
match is-window-cast-target=true
|
||||
match is-urgent=true
|
||||
match at-startup=true
|
||||
|
||||
// Properties that apply once upon window opening.
|
||||
@@ -286,6 +287,19 @@ Example:
|
||||
|
||||

|
||||
|
||||
#### `is-urgent`
|
||||
|
||||
<sup>Since: next release</sup>
|
||||
|
||||
Can be `true` or `false`.
|
||||
Matches windows that request the user's attention.
|
||||
|
||||
```kdl
|
||||
window-rule {
|
||||
match is-urgent=true
|
||||
}
|
||||
```
|
||||
|
||||
#### `at-startup`
|
||||
|
||||
<sup>Since: 0.1.6</sup>
|
||||
|
||||
Reference in New Issue
Block a user