Add open-fullscreen window rule

This commit is contained in:
Ivan Molodetskikh
2024-02-24 08:44:21 +04:00
parent 506dcd99d7
commit ab9d1aab4e
4 changed files with 20 additions and 2 deletions
+4
View File
@@ -585,6 +585,8 @@ pub struct WindowRule {
pub open_on_output: Option<String>,
#[knuffel(child, unwrap(argument))]
pub open_maximized: Option<bool>,
#[knuffel(child, unwrap(argument))]
pub open_fullscreen: Option<bool>,
}
#[derive(knuffel::Decode, Debug, Default, Clone)]
@@ -1065,6 +1067,7 @@ mod tests {
open-on-output "eDP-1"
open-maximized true
open-fullscreen false
}
binds {
@@ -1225,6 +1228,7 @@ mod tests {
}],
open_on_output: Some("eDP-1".to_owned()),
open_maximized: Some(true),
open_fullscreen: Some(false),
..Default::default()
}],
binds: Binds(vec![
+5
View File
@@ -308,6 +308,11 @@ animations {
// Make this window open as a maximized column.
open-maximized true
// Make this window open fullscreen.
open-fullscreen true
// You can also set this to false to prevent a window from opening fullscreen.
// open-fullscreen false
}
// Here's a useful example. Work around WezTerm's initial configure bug
+8 -2
View File
@@ -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);
});
+3
View File
@@ -58,6 +58,9 @@ pub struct ResolvedWindowRules {
/// Whether the window should open full-width.
pub open_maximized: Option<bool>,
/// Whether the window should open fullscreen.
pub open_fullscreen: Option<bool>,
}
impl Unmapped {