From ab9d1aab4ed13027896a80200775e5679fca9539 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 24 Feb 2024 08:44:21 +0400 Subject: Add open-fullscreen window rule --- src/handlers/xdg_shell.rs | 10 ++++++++-- src/window.rs | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 02468518..590dc7a1 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -93,6 +93,10 @@ pub fn resolve_window_rules( if let Some(x) = rule.open_maximized { resolved.open_maximized = Some(x); } + + if let Some(x) = rule.open_fullscreen { + resolved.open_fullscreen = Some(x); + } } resolved.open_on_output = open_on_output.map(|x| x.to_owned()); @@ -604,8 +608,10 @@ impl State { .or_else(|| self.niri.layout.active_workspace()); if let Some(ws) = ws { - // Set a fullscreen state if requested. - if wants_fullscreen.is_some() { + // Set a fullscreen state based on window request and window rule. + if (wants_fullscreen.is_some() && rules.open_fullscreen.is_none()) + || rules.open_fullscreen == Some(true) + { toplevel.with_pending_state(|state| { state.states.set(xdg_toplevel::State::Fullscreen); }); diff --git a/src/window.rs b/src/window.rs index ce62d07b..a5023afa 100644 --- a/src/window.rs +++ b/src/window.rs @@ -58,6 +58,9 @@ pub struct ResolvedWindowRules { /// Whether the window should open full-width. pub open_maximized: Option, + + /// Whether the window should open fullscreen. + pub open_fullscreen: Option, } impl Unmapped { -- cgit