summaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-12-07 16:19:36 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-12-07 16:19:36 -0300
commit69f8194da778a692b6b0c14f43d9611c2072e8ba (patch)
tree8d9f252bf7a6db515a05800a73b35b21d1692cfb /src/command.rs
parent12faa87415d91820503b6b1c98ebabbddc50d665 (diff)
downloaddotwm-69f8194da778a692b6b0c14f43d9611c2072e8ba.tar.gz
Implement desktops.
It's somewhat buggy. But works :). There're 2 desktops only for now, maybe later I will implement something more dynamic
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs13
1 files changed, 8 insertions, 5 deletions
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::<usize>().unwrap();
+ wm.change_desktop(num);
+ true
+}