From 109668fa30bf65e56a2723ff29bcadc3e9a6e4ca Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 21 Sep 2023 13:48:32 +0400 Subject: Add output configuration & integer scaling support --- src/config.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 50ea2451..88773fd3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,6 +11,8 @@ use smithay::input::keyboard::Keysym; pub struct Config { #[knuffel(child, default)] pub input: Input, + #[knuffel(children(name = "output"))] + pub outputs: Vec, #[knuffel(child, default)] pub binds: Binds, #[knuffel(child, default)] @@ -62,6 +64,23 @@ pub struct Touchpad { pub accel_speed: f64, } +#[derive(knuffel::Decode, Debug, Clone, PartialEq)] +pub struct Output { + #[knuffel(argument)] + pub name: String, + #[knuffel(child, unwrap(argument), default = 1.)] + pub scale: f64, +} + +impl Default for Output { + fn default() -> Self { + Self { + name: String::new(), + scale: 1., + } + } +} + #[derive(knuffel::Decode, Debug, Default, PartialEq, Eq)] pub struct Binds(#[knuffel(children)] pub Vec); @@ -263,6 +282,10 @@ mod tests { } } + output "eDP-1" { + scale 2.0 + } + binds { Mod+T { spawn "alacritty"; } Mod+Q { close-window; } @@ -293,6 +316,10 @@ mod tests { accel_speed: 0.2, }, }, + outputs: vec![Output { + name: "eDP-1".to_owned(), + scale: 2., + }], binds: Binds(vec![ Bind { key: Key { -- cgit