aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-27 09:58:22 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit6fba4c371e7868f8d581cf3d49d611cdbb590ad4 (patch)
tree801c85e1ff6df4c9cdb9bcc916e91de70710a512 /src/handlers
parent27911431dbfb8ad5e17ea295a9ae69847577260f (diff)
downloadniri-6fba4c371e7868f8d581cf3d49d611cdbb590ad4.tar.gz
niri-6fba4c371e7868f8d581cf3d49d611cdbb590ad4.tar.bz2
niri-6fba4c371e7868f8d581cf3d49d611cdbb590ad4.zip
Implement default-window-height window rule
Only works for floats that aren't initially fullscreen atm.
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/compositor.rs1
-rw-r--r--src/handlers/xdg_shell.rs17
2 files changed, 16 insertions, 2 deletions
diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs
index 058f8375..ed55ae94 100644
--- a/src/handlers/compositor.rs
+++ b/src/handlers/compositor.rs
@@ -101,6 +101,7 @@ impl CompositorHandler for State {
rules,
width,
floating_width: _,
+ floating_height: _,
is_full_width,
output,
workspace_name,
diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs
index 779612b6..b5d2d3c3 100644
--- a/src/handlers/xdg_shell.rs
+++ b/src/handlers/xdg_shell.rs
@@ -459,7 +459,7 @@ impl XdgShellHandler for State {
toplevel.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Fullscreen);
});
- ws.configure_new_window(&unmapped.window, None, false, rules);
+ ws.configure_new_window(&unmapped.window, None, None, false, rules);
}
// We already sent the initial configure, so we need to reconfigure.
@@ -495,6 +495,7 @@ impl XdgShellHandler for State {
rules,
width,
floating_width,
+ floating_height,
is_full_width,
output,
workspace_name,
@@ -557,9 +558,11 @@ impl XdgShellHandler for State {
} else {
*width
};
+ let configure_height = if is_floating { *floating_height } else { None };
ws.configure_new_window(
&unmapped.window,
configure_width,
+ configure_height,
is_floating,
rules,
);
@@ -840,6 +843,7 @@ impl State {
let mut width = None;
let mut floating_width = None;
+ let mut floating_height = None;
let is_full_width = rules.open_maximized.unwrap_or(false);
let is_floating = rules.compute_open_floating(toplevel);
@@ -865,6 +869,7 @@ impl State {
width = ws.resolve_default_width(rules.default_width, false);
floating_width = ws.resolve_default_width(rules.default_width, true);
+ floating_height = ws.resolve_default_height(rules.default_height, true);
let configure_width = if is_floating {
floating_width
@@ -873,7 +878,14 @@ impl State {
} else {
width
};
- ws.configure_new_window(window, configure_width, is_floating, &rules);
+ let configure_height = if is_floating { floating_height } else { None };
+ ws.configure_new_window(
+ window,
+ configure_width,
+ configure_height,
+ is_floating,
+ &rules,
+ );
}
// If the user prefers no CSD, it's a reasonable assumption that they would prefer to get
@@ -892,6 +904,7 @@ impl State {
rules,
width,
floating_width,
+ floating_height,
is_full_width,
output,
workspace_name: ws.and_then(|w| w.name().cloned()),