From 60abc2c323fa0355d6cd52005561e262efc1b23c Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Thu, 1 Mar 2012 19:42:56 +0200 Subject: rotate non-empty desktops with shortcuts --- monsterwm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'monsterwm.c') diff --git a/monsterwm.c b/monsterwm.c index 78cb34a..ff1eefb 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -91,6 +91,7 @@ static void next_win(); static void prev_win(); static void quit(const Arg *arg); static void rotate(const Arg *arg); +static void rotate_filled(const Arg *arg); static void spawn(const Arg *arg); static void swap_master(); static void switch_mode(const Arg *arg); @@ -948,6 +949,15 @@ void rotate(const Arg *arg) { change_desktop(&(Arg){.i = (DESKTOPS + currdeskidx + arg->i) % DESKTOPS}); } +/** + * jump and focus the next non-empty desktop + */ +void rotate_filled(const Arg *arg) { + int n = arg->i; + while (n < DESKTOPS && !desktops[(DESKTOPS + currdeskidx + n) % DESKTOPS].head) (n += arg->i); + change_desktop(&(Arg){.i = (DESKTOPS + currdeskidx + n) % DESKTOPS}); +} + /** * main event loop * on receival of an event call the appropriate handler -- cgit v1.3.1