diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2016-02-07 06:03:23 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2016-02-07 06:03:23 -0300 |
commit | 9659fd77dd2a0030d51e20b2dde502ce33bf6081 (patch) | |
tree | 01498976c8fba02b576e8f06181eca1f701b13b5 | |
parent | 82d39a36202a4e46d216ac46fcc4d80ad9c45227 (diff) | |
download | dotwm-9659fd77dd2a0030d51e20b2dde502ce33bf6081.tar.gz |
Change the plain exec_func with something better.
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 90126a6..2f5e80c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,6 +30,16 @@ use unix_socket::UnixListener; const SOCKET_PATH: &'static str = "./dotwm.sock"; +fn run_autostart() { + let paths = &["./autostart", "/home/matias/.config/dotwm/autostart"]; + for path in paths { + match exec_cmd(path, &[]) { + Ok(_) => break, + Err(_) => (), + } + } +} + fn main() { println!("Creating dotwm"); let mut dotwm = DotWM::new(); @@ -40,12 +50,12 @@ fn main() { let listener = UnixListener::bind(SOCKET_PATH).unwrap(); - exec_cmd("./autostart", &[]).unwrap(); + run_autostart(); // Main loop while !dotwm.finish { let event = unsafe { select_event(dotwm.display, x11_fd, &listener) }; - println!("Event: {:?}", event); + //println!("Event: {:?}", event); match event { Event::Key(mut e, true) => { let keysym = unsafe { xlib::XLookupKeysym(&mut e, 0) as u32 }; |