diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-27 09:58:22 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-30 20:12:37 +0300 |
| commit | 6fba4c371e7868f8d581cf3d49d611cdbb590ad4 (patch) | |
| tree | 801c85e1ff6df4c9cdb9bcc916e91de70710a512 /src/window | |
| parent | 27911431dbfb8ad5e17ea295a9ae69847577260f (diff) | |
| download | niri-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/window')
| -rw-r--r-- | src/window/mod.rs | 14 | ||||
| -rw-r--r-- | src/window/unmapped.rs | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/window/mod.rs b/src/window/mod.rs index 0b0b5f1e..44d5359e 100644 --- a/src/window/mod.rs +++ b/src/window/mod.rs @@ -1,6 +1,6 @@ use std::cmp::{max, min}; -use niri_config::{BlockOutFrom, BorderRule, CornerRadius, Match, WindowRule}; +use niri_config::{BlockOutFrom, BorderRule, CornerRadius, Match, PresetSize, WindowRule}; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; use smithay::utils::{Logical, Size}; use smithay::wayland::compositor::with_states; @@ -34,6 +34,13 @@ pub struct ResolvedWindowRules { /// - `Some(Some(width))`: set to a particular width. pub default_width: Option<Option<ColumnWidth>>, + /// Default height for this window. + /// + /// - `None`: unset (global default should be used). + /// - `Some(None)`: set to empty (window picks its own height). + /// - `Some(Some(width))`: set to a particular height. + pub default_height: Option<Option<PresetSize>>, + /// Output to open this window on. pub open_on_output: Option<String>, @@ -114,6 +121,7 @@ impl ResolvedWindowRules { pub const fn empty() -> Self { Self { default_width: None, + default_height: None, open_on_output: None, open_on_workspace: None, open_maximized: None, @@ -192,6 +200,10 @@ impl ResolvedWindowRules { resolved.default_width = Some(x); } + if let Some(x) = rule.default_window_height { + resolved.default_height = Some(x.0); + } + if let Some(x) = rule.open_on_output.as_deref() { open_on_output = Some(x); } diff --git a/src/window/unmapped.rs b/src/window/unmapped.rs index 3ea0f1d8..18073a98 100644 --- a/src/window/unmapped.rs +++ b/src/window/unmapped.rs @@ -1,3 +1,4 @@ +use niri_config::PresetSize; use smithay::desktop::Window; use smithay::output::Output; use smithay::wayland::shell::xdg::ToplevelSurface; @@ -40,6 +41,11 @@ pub enum InitialConfigureState { /// `None` means that the window will pick its own width. floating_width: Option<ColumnWidth>, + /// Resolved floating default height for this window. + /// + /// `None` means that the window will pick its own height. + floating_height: Option<PresetSize>, + /// Whether the window should open full-width. is_full_width: bool, |
