diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-24 10:08:56 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-24 10:08:56 +0400 |
| commit | ec156a858795b7f31cac51845d9cf3197a063f92 (patch) | |
| tree | b0da6c94a24286d8ddb3da79c9cd14531f85830e | |
| parent | e278e871c357c4832f29629e4f65f57ff0d0ded0 (diff) | |
| download | niri-ec156a858795b7f31cac51845d9cf3197a063f92.tar.gz niri-ec156a858795b7f31cac51845d9cf3197a063f92.tar.bz2 niri-ec156a858795b7f31cac51845d9cf3197a063f92.zip | |
Add environment {} config section
| -rw-r--r-- | niri-config/src/lib.rs | 28 | ||||
| -rw-r--r-- | resources/default-config.kdl | 9 | ||||
| -rw-r--r-- | src/main.rs | 5 | ||||
| -rw-r--r-- | src/niri.rs | 5 | ||||
| -rw-r--r-- | src/utils/spawning.rs | 14 |
5 files changed, 59 insertions, 2 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 2b40e7a9..65614966 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -39,6 +39,8 @@ pub struct Config { pub hotkey_overlay: HotkeyOverlay, #[knuffel(child, default)] pub animations: Animations, + #[knuffel(child, default)] + pub environment: Environment, #[knuffel(children(name = "window-rule"))] pub window_rules: Vec<WindowRule>, #[knuffel(child, default)] @@ -572,6 +574,17 @@ pub enum AnimationCurve { EaseOutExpo, } +#[derive(knuffel::Decode, Debug, Default, Clone, PartialEq, Eq)] +pub struct Environment(#[knuffel(children)] pub Vec<EnvironmentVariable>); + +#[derive(knuffel::Decode, Debug, Clone, PartialEq, Eq)] +pub struct EnvironmentVariable { + #[knuffel(node_name)] + pub name: String, + #[knuffel(argument)] + pub value: Option<String>, +} + #[derive(knuffel::Decode, Debug, Default, Clone, PartialEq)] pub struct WindowRule { #[knuffel(children(name = "match"))] @@ -1061,6 +1074,11 @@ mod tests { } } + environment { + QT_QPA_PLATFORM "wayland" + DISPLAY null + } + window-rule { match app-id=".*alacritty" exclude title="~" @@ -1217,6 +1235,16 @@ mod tests { }, ..Default::default() }, + environment: Environment(vec![ + EnvironmentVariable { + name: String::from("QT_QPA_PLATFORM"), + value: Some(String::from("wayland")), + }, + EnvironmentVariable { + name: String::from("DISPLAY"), + value: None, + }, + ]), window_rules: vec