From 9659fd77dd2a0030d51e20b2dde502ce33bf6081 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sun, 7 Feb 2016 06:03:23 -0300 Subject: Change the plain exec_func with something better. --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') 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 }; -- cgit v1.2.3-70-g09d2