From 69f8194da778a692b6b0c14f43d9611c2072e8ba Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 7 Dec 2015 16:19:36 -0300 Subject: Implement desktops. It's somewhat buggy. But works :). There're 2 desktops only for now, maybe later I will implement something more dynamic --- src/command.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/command.rs') diff --git a/src/command.rs b/src/command.rs index f351e14..8f7218e 100644 --- a/src/command.rs +++ b/src/command.rs @@ -95,8 +95,7 @@ pub fn move_win_to(wm: &mut DotWM, _: xlib::XEvent, args: &[String]) -> bool { if let Some(ref win) = wm.current_window() { match win.move_to(x, y) { Ok(()) => true, - Err(e) => { - println!("{}", e); + Err(_) => { false } } @@ -194,7 +193,7 @@ pub fn resize_win_sticky(wm: &mut DotWM, _: xlib::XEvent, args: &[String]) -> bo let val = xgeo.iter().skip_while(|&a| *a <= win_right).next(); if let Some(xpoint) = val { - let new_width = (*xpoint - attrs.x); + let new_width = *xpoint - attrs.x; let _ = win.resize_to(new_width, attrs.height); } }, @@ -205,7 +204,6 @@ pub fn resize_win_sticky(wm: &mut DotWM, _: xlib::XEvent, args: &[String]) -> bo let val = ygeo.iter().skip_while(|&a| *a >= attrs.y + attrs.height).next(); if let Some(v) = val { let diff = attrs.height - (*v - attrs.y); - println!("Resizing to {}x{}", attrs.width, diff); if *v - attrs.y > 0 { let _ = win.resize_to(attrs.width, attrs.height - diff); } @@ -219,7 +217,6 @@ pub fn resize_win_sticky(wm: &mut DotWM, _: xlib::XEvent, args: &[String]) -> bo let val = ygeo.iter().skip_while(|&a| *a <= win_bot).next(); if let Some(v) = val { let new_height = *v - attrs.y; - println!("Resizing to {}x{}", attrs.width, new_height); let _ = win.resize_to(attrs.width, new_height); } }, @@ -274,3 +271,9 @@ pub fn add_binding(wm: &mut DotWM, bindings: &mut BindingHash, } bindings.insert((key, modifiers), (func, v)); } + +pub fn change_desktop(wm: &mut DotWM, _: xlib::XEvent, args: &[String]) -> bool { + let num = args[0].parse::().unwrap(); + wm.change_desktop(num); + true +} -- cgit v1.2.3-70-g09d2