aboutsummaryrefslogtreecommitdiff
path: root/src/niri.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/niri.rs')
-rw-r--r--src/niri.rs31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/niri.rs b/src/niri.rs
index 13aa6409..08f195fc 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -114,7 +114,7 @@ use crate::utils::spawning::CHILD_ENV;
use crate::utils::{
center, center_f64, get_monotonic_time, make_screenshot_path, output_size, write_png_rgba8,
};
-use crate::window::{Mapped, Unmapped};
+use crate::window::{InitialConfigureState, Mapped, ResolvedWindowRules, Unmapped};
use crate::{animation, niri_render_elements};
const CLEAR_COLOR: [f32; 4] = [0.2, 0.2, 0.2, 1.];
@@ -761,6 +761,7 @@ impl State {
let mut reload_xkb = None;
let mut libinput_config_changed = false;
let mut output_config_changed = false;
+ let mut window_rules_changed = false;
let mut old_config = self.niri.config.borrow_mut();
// Reload the cursor.
@@ -802,6 +803,10 @@ impl State {
self.niri.hotkey_overlay.on_hotkey_config_updated();
}
+ if config.window_rules != old_config.window_rules {
+ window_rules_changed = true;
+ }
+
*old_config = config;
// Release the borrow.
@@ -865,6 +870,30 @@ impl State {
}
}
+ if window_rules_changed {
+ let _span = tracy_client::span!("recompute window rules");
+
+ let window_rules = &self.niri.config.borrow().window_rules;
+
+ for unmapped in self.niri.unmapped_windows.values_mut() {
+ if let InitialConfigureState::Configured { rules, .. } = &mut unmapped.state {
+ *rules = ResolvedWindowRules::compute(
+ window_rules,
+ unmapped.window.toplevel().expect("no X11 support"),
+ );
+ }
+ }
+
+ let mut windows = vec![];
+ self.niri.layout.with_windows_mut(|mapped, _| {
+ mapped.rules = ResolvedWindowRules::compute(window_rules, mapped.toplevel());
+ windows.push(mapped.window.clone());
+ });
+ for win in windows {
+ self.niri.layout.update_window(&win);
+ }
+ }
+
// Can't really update xdg-decoration settings since we have to hide the globals for CSD
// due to the SDL2 bug... I don't imagine clients are prepared for the xdg-decoration
// global suddenly appearing? Either way, right now it's live-reloaded in a sense that new