diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.rs | 26 | ||||
| -rw-r--r-- | src/layout.rs | 42 |
2 files changed, 64 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs index b5428429..b5e98adf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -28,6 +28,8 @@ pub struct Config { pub default_column_width: Option<DefaultColumnWidth>, #[knuffel(child, unwrap(argument), default = 16)] pub gaps: u16, + #[knuffel(child, default)] + pub struts: Struts, #[knuffel( child, unwrap(argument), @@ -238,6 +240,18 @@ pub enum PresetWidth { #[derive(knuffel::Decode, Debug, Clone, PartialEq)] pub struct DefaultColumnWidth(#[knuffel(children)] pub Vec<PresetWidth>); +#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)] +pub struct Struts { + #[knuffel(child, unwrap(argument), default)] + pub left: u16, + #[knuffel(child, unwrap(argument), default)] + pub right: u16, + #[knuffel(child, unwrap(argument), default)] + pub top: u16, + #[knuffel(child, unwrap(argument), default)] + pub bottom: u16, +} + #[derive(knuffel::Decode, Debug, Default, PartialEq)] pub struct Binds(#[knuffel(children)] pub Vec<Bind>); @@ -594,6 +608,12 @@ mod tests { gaps 8 + struts { + left 1 + right 2 + top 3 + } + screenshot-path "~/Screenshots/screenshot.png" binds { @@ -673,6 +693,12 @@ mod tests { ], default_column_width: Some(DefaultColumnWidth(vec![PresetWidth::Proportion(0.25)])), gaps: 8, + struts: Struts { + left: 1, + right: 2, + top: 3, + bottom: 0, + }, screenshot_path: Some(String::from("~/Screenshots/screenshot.png")), binds: Binds(vec![ Bind { diff --git a/src/layout.rs b/src/layout.rs index b53529f5..bf012311 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -56,7 +56,7 @@ use smithay::wayland::compositor::{send_surface_state, with_states}; use smithay::wayland::shell::xdg::SurfaceCachedState; use crate::animation::Animation; -use crate::config::{self, Color, Config, PresetWidth, SizeChange}; +use crate::config::{self, Color, Config, PresetWidth, SizeChange, Struts}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct OutputId(String); @@ -205,6 +205,8 @@ struct FocusRing { struct Options { /// Padding around windows in logical pixels. gaps: i32, + /// Extra padding around the working area in logical pixels. + struts: Struts, focus_ring: config::FocusRing, /// Column widths that `toggle_width()` switches between. preset_widths: Vec<ColumnWidth>, @@ -216,6 +218,7 @@ impl Default for Options { fn default() -> Self { Self { gaps: 16, + struts: Default::default(), focus_ring: Default::default(), preset_widths: vec