summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index c89544d..feda9e0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -47,6 +47,8 @@ fn main() {
dotwm.add_binding(keysym::XK_Return, xlib::Mod4Mask, exec,
&["xterm"]);
+ dotwm.add_binding(keysym::XK_p, xlib::Mod4Mask, exec,
+ &["dmenu_run"]);
dotwm.add_binding(keysym::XK_h, xlib::Mod4Mask, move_win, &["-10", "0"]);
dotwm.add_binding(keysym::XK_j, xlib::Mod4Mask, move_win, &["0", "10"]);
dotwm.add_binding(keysym::XK_k, xlib::Mod4Mask, move_win, &["0", "-10"]);
@@ -57,6 +59,7 @@ fn main() {
// Main loop
loop {
let event = next_event(dotwm.display);
+ println!("Event {:?}", event);
match event {
Event::Key(mut e, true) => {
let keysym = unsafe { xlib::XLookupKeysym(&mut e, 0) as u32 };
@@ -69,7 +72,15 @@ fn main() {
let create_event = xlib::XCreateWindowEvent::from(e);
dotwm.add_window(create_event.window);
}
- _ => println!("Catched event! {:?}", event),
+ Event::Destroy(e) => {
+ dotwm.remove_window(e.window);
+ },
+ Event::Enter(e) => {
+ if let Some(idx) = dotwm.find_window(e.window) {
+ dotwm.change_focus_of(idx);
+ }
+ },
+ _ => (),
}
}
}