diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-12-27 21:51:42 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-12-27 21:51:42 +0400 |
| commit | c21805bf705bd36a6eb7f79039b759e9af79dfcb (patch) | |
| tree | e24213b023c8129320daa782c8b0830ea334d519 /src/config.rs | |
| parent | bfc24182670a0b3e17f79d66474fd291b7110732 (diff) | |
| download | niri-c21805bf705bd36a6eb7f79039b759e9af79dfcb.tar.gz niri-c21805bf705bd36a6eb7f79039b759e9af79dfcb.tar.bz2 niri-c21805bf705bd36a6eb7f79039b759e9af79dfcb.zip | |
layout: Refactor to support window decorations, add border and fullscreen backdrop
Windows are now wrapped in Tiles, which keep track of window-specific
decorations. Particularly, I implemented a black fullscreen backdrop,
which finally brings fullscreened windows smaller than the screen in
line with how the Wayland protocol says they should lookâcentered in a
black rectangle. I also implemented window borders, which are similar to
the focus ring, but always visible (and hence affect the layout and
sizing).
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index b5e98adf..ff096017 100644 --- a/src/config.rs +++ b/src/config.rs @@ -18,6 +18,8 @@ pub struct Config { pub spawn_at_startup: Vec<SpawnAtStartup>, #[knuffel(child, default)] pub focus_ring: FocusRing, + #[knuffel(child, default = default_border())] + pub border: FocusRing, #[knuffel(child, default)] pub prefer_no_csd: bool, #[knuffel(child, default)] @@ -190,6 +192,15 @@ impl Default for FocusRing { } } +pub const fn default_border() -> FocusRing { + FocusRing { + off: true, + width: 4, + active_color: Color::new(255, 200, 127, 255), + inactive_color: Color::new(80, 80, 80, 255), + } +} + #[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)] pub struct Color { #[knuffel(argument)] @@ -203,7 +214,7 @@ pub struct Color { } impl Color { - pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self { + pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Self { Self { r, g, b, a } } } @@ -590,6 +601,12 @@ mod tests { inactive-color 255 200 100 0 } + border { + width 3 + active-color 0 100 200 255 + inactive-color 255 200 100 0 + } + prefer-no-csd cursor { @@ -680,6 +697,22 @@ mod tests { a: 0, }, }, + border: FocusRing { + off: false, + width: 3, + active_color: Color { + r: 0, + g: 100, + b: 200, + a: 255, + }, + inactive_color: Color { + r: 255, + g: 200, + b: 100, + a: 0, + }, + }, prefer_no_csd: true, cursor: Cursor { xcursor_theme: String::from("breeze_cursors"), |
