aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h2
-rw-r--r--monsterwm.c10
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
*/