diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-03-01 19:42:56 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-12-16 02:11:13 +0200 |
| commit | 60abc2c323fa0355d6cd52005561e262efc1b23c (patch) | |
| tree | a4dc78a6d322539a7f83d1d6c73de535259c9edd | |
| parent | 2cfded4c873ba0ec4401c9c155505c16931f5f06 (diff) | |
rotate non-empty desktops with shortcuts
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | monsterwm.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h index 1dfe4fe..835d2b3 100644 --- a/config.def.h +++ b/config.def.h @@ -63,6 +63,8 @@ static Key keys[] = { { MOD1, XK_k, prev_win, {NULL}}, { MOD1|CONTROL, XK_h, rotate, {.i = -1}}, { MOD1|CONTROL, XK_l, rotate, {.i = +1}}, + { MOD1|SHIFT, XK_h, rotate_filled, {.i = -1}}, + { MOD1|SHIFT, XK_l, rotate_filled, {.i = +1}}, { MOD1, XK_Tab, last_desktop, {NULL}}, { MOD1, XK_Return, swap_master, {NULL}}, { MOD1|SHIFT, XK_j, move_down, {NULL}}, 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); @@ -949,6 +950,15 @@ void rotate(const Arg *arg) { } /** + * 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 */ |
