From 3e598c565e6e8ad4c34e93aec9a49e60d51d730e Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 24 Apr 2024 21:49:07 +0400 Subject: Implement border window rule --- src/window/mod.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/window') diff --git a/src/window/mod.rs b/src/window/mod.rs index 3c46e9e5..a793cedb 100644 --- a/src/window/mod.rs +++ b/src/window/mod.rs @@ -1,4 +1,4 @@ -use niri_config::{BlockOutFrom, Match, WindowRule}; +use niri_config::{BlockOutFrom, BorderRule, Match, WindowRule}; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; use smithay::wayland::compositor::with_states; use smithay::wayland::shell::xdg::{ @@ -48,6 +48,9 @@ pub struct ResolvedWindowRules { /// Extra bound on the maximum window height. pub max_height: Option, + /// Window border overrides. + pub border: BorderRule, + /// Whether or not to draw the border with a solid background. /// /// `None` means using the SSD heuristic. @@ -87,6 +90,15 @@ impl ResolvedWindowRules { min_height: None, max_width: None, max_height: None, + border: BorderRule { + off: false, + on: false, + width: None, + active_color: None, + inactive_color: None, + active_gradient: None, + inactive_gradient: None, + }, draw_border_with_background: None, opacity: None, block_out_from: None, @@ -158,6 +170,8 @@ impl ResolvedWindowRules { resolved.max_height = Some(x); } + resolved.border.merge_with(&rule.border); + if let Some(x) = rule.draw_border_with_background { resolved.draw_border_with_background = Some(x); } -- cgit