diff options
Diffstat (limited to 'src/window')
| -rw-r--r-- | src/window/mapped.rs | 12 | ||||
| -rw-r--r-- | src/window/mod.rs | 12 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs index bdb62df8..4864d62e 100644 --- a/src/window/mapped.rs +++ b/src/window/mapped.rs @@ -120,10 +120,10 @@ impl Mapped { } /// Recomputes the resolved window rules and returns whether they changed. - pub fn recompute_window_rules(&mut self, rules: &[WindowRule]) -> bool { + pub fn recompute_window_rules(&mut self, rules: &[WindowRule], is_at_startup: bool) -> bool { self.need_to_recompute_rules = false; - let new_rules = ResolvedWindowRules::compute(rules, WindowRef::Mapped(self)); + let new_rules = ResolvedWindowRules::compute(rules, WindowRef::Mapped(self), is_at_startup); if new_rules == self.rules { return false; } @@ -132,12 +132,16 @@ impl Mapped { true } - pub fn recompute_window_rules_if_needed(&mut self, rules: &[WindowRule]) -> bool { + pub fn recompute_window_rules_if_needed( + &mut self, + rules: &[WindowRule], + is_at_startup: bool, + ) -> bool { if !self.need_to_recompute_rules { return false; } - self.recompute_window_rules(rules) + self.recompute_window_rules(rules, is_at_startup) } pub fn is_focused(&self) -> bool { diff --git a/src/window/mod.rs b/src/window/mod.rs index 92b4f793..9bdbd887 100644 --- a/src/window/mod.rs +++ b/src/window/mod.rs @@ -135,7 +135,7 @@ impl ResolvedWindowRules { } } - pub fn compute(rules: &[WindowRule], window: WindowRef) -> Self { + pub fn compute(rules: &[WindowRule], window: WindowRef, is_at_startup: bool) -> Self { let _span = tracy_client::span!("ResolvedWindowRules::compute"); let mut resolved = ResolvedWindowRules::empty(); @@ -158,7 +158,15 @@ impl ResolvedWindowRules { let mut open_on_workspace = None; for rule in rules { - let matches = |m| window_matches(window, &role, m); + let matches = |m: &Match| { + if let Some(at_startup) = m.at_startup { + if at_startup != is_at_startup { + return false; + } + } + + window_matches(window, &role, m) + }; if !(rule.matches.is_empty() || rule.matches.iter().any(matches)) { continue; |
