diff options
author | tcmal <me@aria.rip> | 2024-08-30 15:14:08 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-30 15:37:59 +0100 |
commit | 7ab9f225632a1de377c4814c80dfa76f81d6c783 (patch) | |
tree | b8e75b3fd920fae52233edc866d43be1bbad8632 | |
parent | e6d583df4243e18707dfabbf375b57d811f07bf3 (diff) |
Add optional autostart feature
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/config.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 8 |
3 files changed, 13 insertions, 0 deletions
@@ -10,3 +10,4 @@ xkeysym = "0.2.0" [features] debug = ["xcb/debug_atom_names"] +autostart = [] diff --git a/src/config.rs b/src/config.rs index f3b40f6..f052c22 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,6 +27,10 @@ pub const BORDER_FOCUSED: Colour = Colour::from_hex(0xff0000); /// The main modifier used for keybinds. pub const MAIN_MODIFIER: ModMask = ModMask::CONTROL; +/// Commands to run as soon as setup is done +#[cfg(feature = "autostart")] +pub const AUTOSTART_SCRIPTS: &[&[&str]] = &[]; + /// The keybinds to use. pub const KEYBINDS: Keybinds = Keybinds(&[ bind!(MAIN_MODIFIER , Return -> &|_| spawn::<_, &str>("dmenu_run", [])), diff --git a/src/main.rs b/src/main.rs index ec2475c..1f98801 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,6 +53,14 @@ fn main() -> Result<()> { #[allow(clippy::cast_sign_loss)] let mut wm = WM::new(&conn, screen_num as usize)?; + + #[cfg(feature = "autostart")] + { + for to_start in config::AUTOSTART_SCRIPTS { + helpers::spawn(to_start[0], &to_start[1..]); + } + } + wm.event_loop()?; Ok(()) |