diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-21 19:58:03 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-21 19:58:03 +0400 |
| commit | a7e338b3c0aeb37f7cc6095f27056fc77e1760a7 (patch) | |
| tree | 9f61b1b7966454dd0af7c72da25475f3bc9521cd | |
| parent | 80dce054cb8da4a34b1863a7642baeeebf66ebbe (diff) | |
| download | niri-a7e338b3c0aeb37f7cc6095f27056fc77e1760a7.tar.gz niri-a7e338b3c0aeb37f7cc6095f27056fc77e1760a7.tar.bz2 niri-a7e338b3c0aeb37f7cc6095f27056fc77e1760a7.zip | |
Add spawn-at-startup config option
Fixes https://github.com/YaLTeR/niri/issues/12
| -rw-r--r-- | resources/default-config.kdl | 5 | ||||
| -rw-r--r-- | src/config.rs | 13 | ||||
| -rw-r--r-- | src/main.rs | 12 |
3 files changed, 28 insertions, 2 deletions
diff --git a/resources/default-config.kdl b/resources/default-config.kdl index 7596fba3..3e15b260 100644 --- a/resources/default-config.kdl +++ b/resources/default-config.kdl @@ -35,6 +35,11 @@ input { scale 2.0 } +// Add lines like this to spawn processes at startup. +// Note that running niri as a session supports xdg-desktop-autostart, +// which may be more convenient to use. +// spawn-at-startup "alacritty" "-e" "fish" + binds { // Keys consist of modifiers separated by + signs, followed by an XKB key name // in the end. To find an XKB name for a particular key, you may use a program diff --git a/src/config.rs b/src/config.rs index 88773fd3..dd664ff8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -13,6 +13,8 @@ pub struct Config { pub input: Input, #[knuffel(children(name = "output"))] pub outputs: Vec<Output>, + #[knuffel(children(name = "spawn-at-startup"))] + pub spawn_at_startup: Vec<SpawnAtStartup>, #[knuffel(child, default)] pub binds: Binds, #[knuffel(child, default)] @@ -81,6 +83,12 @@ impl Default for Output { } } +#[derive(knuffel::Decode, Debug, Clone, PartialEq, Eq)] +pub struct SpawnAtStartup { + #[knuffel(arguments)] + pub command: Vec<String>, +} + #[derive(knuffel::Decode, Debug, Default, PartialEq, Eq)] pub struct Binds(#[knuffel(children)] pub Vec<Bind>); @@ -286,6 +294,8 @@ mod tests { scale 2.0 } + spawn-at-startup "alacritty" "-e" "fish" + binds { Mod+T { spawn "alacritty"; } Mod+Q { close-window; } @@ -320,6 +330,9 @@ mod tests { name: "eDP-1".to_owned(), scale: 2., }], + spawn_at_startup: vec![SpawnAtStartup { + command: vec!["alacritty".to_owned(), "-e".to_owned(), "fish".to_owned()], + }], binds: Binds(vec