aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-21 13:48:32 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-21 13:48:50 +0400
commit109668fa30bf65e56a2723ff29bcadc3e9a6e4ca (patch)
treed95fbf3bdb3c2c14683a34d8bb7203b7dae4820d /src/config.rs
parentcfa73c153cc6ae2f1c21dcbbc8e755b265babbd2 (diff)
downloadniri-109668fa30bf65e56a2723ff29bcadc3e9a6e4ca.tar.gz
niri-109668fa30bf65e56a2723ff29bcadc3e9a6e4ca.tar.bz2
niri-109668fa30bf65e56a2723ff29bcadc3e9a6e4ca.zip
Add output configuration & integer scaling support
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs27
1 files changed, 27 insertions, 0 deletions
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<Output>,
#[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<Bind>);
@@ -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 {