diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 31d0423..b0b5b9b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,6 @@ #![cfg_attr(feature="clippy", plugin(clippy))] extern crate libc; extern crate x11; -extern crate unix_socket; #[macro_use] extern crate lazy_static; @@ -32,7 +31,7 @@ use std::fs; use std::env; use std::path::{PathBuf}; use std::io::{Read,Write}; -use unix_socket::UnixListener; +use std::os::unix::net::UnixListener; fn dotwm_dir() -> PathBuf { let mut path = env::home_dir().unwrap(); @@ -79,7 +78,6 @@ fn main() { // Main loop while !dotwm.finish { let event = unsafe { select_event(dotwm.display, x11_fd, &listener) }; - //println!("Event: {:?}", event); match event { Event::Key(mut e, true) => { let keysym = unsafe { xlib::XLookupKeysym(&mut e, 0) as u32 }; @@ -92,6 +90,7 @@ fn main() { // be handled by the wm. let map_event = xlib::XMapEvent::from(e); if map_event.override_redirect == 0 { + println!("Creating window {}", map_event.window); dotwm.add_window(map_event.window); } } @@ -114,19 +113,18 @@ fn main() { exec_func(&mut dotwm, &mut bindings, 1, e.state, xlib::XEvent::from(e)); }, Event::Socket(stream) => { - let mut s = stream.try_clone().unwrap(); + let mut s = stream.try_clone().expect("Cannot clone stream"); let mut buf = String::new(); - s.read_to_string(&mut buf).unwrap(); - + s.read_to_string(&mut buf).expect("Cannot read from string"); for line in buf.lines() { let res = parser::parse(line); match res { Ok(pcmd) => { pcmd.handle(&mut dotwm, &mut bindings); - let _ = write!(s, "+ok"); + let _ = write!(s, "+ok\n"); }, Err(e) => { - let _ = write!(s, "-{}", e); + let _ = write!(s, "-{}\n", e); }, } } |