From: Lawrence Teo Date: Tue, 29 Nov 2011 03:41:58 +0000 (-0500) Subject: Cycle through all workspaces (empty or not) with M- and M-. X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=1c354dfac092c948cee6aa0c04ec13380e15a8bb;p=spectrwm.git Cycle through all workspaces (empty or not) with M- and M-. Adapted from a diff by Splex ok marco --- diff --git a/scrotwm.1 b/scrotwm.1 index 2059214..d47304c 100644 --- a/scrotwm.1 +++ b/scrotwm.1 @@ -401,6 +401,10 @@ wind_kill ws_next .It Cm M- Ns Aq Cm Left ws_prev +.It Cm M- Ns Aq Cm Up +ws_next_all +.It Cm M- Ns Aq Cm Down +ws_prev_all .It Cm M-a ws_prior .It Cm M-S- Ns Aq Cm Right @@ -514,6 +518,10 @@ is 1 through 10. Switch to next workspace with a window in it. .It Cm ws_prev Switch to previous workspace with a window in it. +.It Cm ws_next_all +Switch to next workspace. +.It Cm ws_prev_all +Switch to previous workspace. .It Cm ws_prior Switch to last visited workspace. .It Cm screen_next diff --git a/scrotwm.c b/scrotwm.c index 06b4a97..dfbdefc 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -425,6 +425,8 @@ union arg { #define SWM_ARG_ID_CYCLEWS_DOWN (41) #define SWM_ARG_ID_CYCLESC_UP (42) #define SWM_ARG_ID_CYCLESC_DOWN (43) +#define SWM_ARG_ID_CYCLEWS_UP_ALL (44) +#define SWM_ARG_ID_CYCLEWS_DOWN_ALL (45) #define SWM_ARG_ID_STACKINC (50) #define SWM_ARG_ID_STACKDEC (51) #define SWM_ARG_ID_SS_ALL (60) @@ -2145,6 +2147,7 @@ cyclews(struct swm_region *r, union arg *args) { union arg a; struct swm_screen *s = r->s; + int cycle_all = 0; DNPRINTF(SWM_D_WS, "cyclews id %d " "in screen[%d]:%dx%d+%d+%d ws %d\n", args->id, @@ -2153,12 +2156,18 @@ cyclews(struct swm_region *r, union arg *args) a.id = r->ws->idx; do { switch (args->id) { + case SWM_ARG_ID_CYCLEWS_UP_ALL: + cycle_all = 1; + /* FALLTHROUGH */ case SWM_ARG_ID_CYCLEWS_UP: if (a.id < SWM_WS_MAX - 1) a.id++; else a.id = 0; break; + case SWM_ARG_ID_CYCLEWS_DOWN_ALL: + cycle_all = 1; + /* FALLTHROUGH */ case SWM_ARG_ID_CYCLEWS_DOWN: if (a.id > 0) a.id--; @@ -2169,7 +2178,8 @@ cyclews(struct swm_region *r, union arg *args) return; }; - if (cycle_empty == 0 && TAILQ_EMPTY(&s->ws[a.id].winlist)) + if (!cycle_all && + (cycle_empty == 0 && TAILQ_EMPTY(&s->ws[a.id].winlist))) continue; if (cycle_visible == 0 && s->ws[a.id].r != NULL) continue; @@ -3692,6 +3702,8 @@ enum keyfuncid { kf_ws_10, kf_ws_next, kf_ws_prev, + kf_ws_next_all, + kf_ws_prev_all, kf_ws_prior, kf_screen_next, kf_screen_prev, @@ -3778,6 +3790,8 @@ struct keyfunc { { "ws_10", switchws, {.id = 9} }, { "ws_next", cyclews, {.id = SWM_ARG_ID_CYCLEWS_UP} }, { "ws_prev", cyclews, {.id = SWM_ARG_ID_CYCLEWS_DOWN} }, + { "ws_next_all", cyclews, {.id = SWM_ARG_ID_CYCLEWS_UP_ALL} }, + { "ws_prev_all", cyclews, {.id = SWM_ARG_ID_CYCLEWS_DOWN_ALL} }, { "ws_prior", priorws, {0} }, { "screen_next", cyclescr, {.id = SWM_ARG_ID_CYCLESC_UP} }, { "screen_prev", cyclescr, {.id = SWM_ARG_ID_CYCLESC_DOWN} }, @@ -4378,6 +4392,8 @@ setup_keys(void) setkeybinding(MODKEY, XK_0, kf_ws_10, NULL); setkeybinding(MODKEY, XK_Right, kf_ws_next, NULL); setkeybinding(MODKEY, XK_Left, kf_ws_prev, NULL); + setkeybinding(MODKEY, XK_Up, kf_ws_next_all, NULL); + setkeybinding(MODKEY, XK_Down, kf_ws_prev_all, NULL); setkeybinding(MODKEY, XK_a, kf_ws_prior, NULL); setkeybinding(MODKEY|ShiftMask, XK_Right, kf_screen_next, NULL); setkeybinding(MODKEY|ShiftMask, XK_Left, kf_screen_prev, NULL); diff --git a/scrotwm_cz.conf b/scrotwm_cz.conf index 94ac96d..f332bc8 100644 --- a/scrotwm_cz.conf +++ b/scrotwm_cz.conf @@ -30,6 +30,8 @@ bind[ws_9] = MOD+iacute bind[ws_10] = MOD+eacute bind[ws_next] = MOD+Right bind[ws_prev] = MOD+Left +bind[ws_next_all] = MOD+Up +bind[ws_prev_all] = MOD+Down bind[screen_next] = MOD+Shift+Right bind[screen_prev] = MOD+Shift+Left bind[mvws_1] = MOD+Shift+plus diff --git a/scrotwm_es.conf b/scrotwm_es.conf index a52727b..eb825da 100644 --- a/scrotwm_es.conf +++ b/scrotwm_es.conf @@ -30,6 +30,8 @@ bind[ws_9] = MOD+9 bind[ws_10] = MOD+0 bind[ws_next] = MOD+Right bind[ws_prev] = MOD+Left +bind[ws_next_all] = MOD+Up +bind[ws_prev_all] = MOD+Down bind[screen_next] = MOD+Shift+Right bind[screen_prev] = MOD+Shift+Left bind[mvws_1] = MOD+Shift+1 diff --git a/scrotwm_fr.conf b/scrotwm_fr.conf index 3c211a7..deabd00 100644 --- a/scrotwm_fr.conf +++ b/scrotwm_fr.conf @@ -30,6 +30,8 @@ bind[ws_9] = MOD+ccedilla bind[ws_10] = MOD+agrave bind[ws_next] = MOD+Right bind[ws_prev] = MOD+Left +bind[ws_next_all] = MOD+Up +bind[ws_prev_all] = MOD+Down bind[screen_next] = MOD+Shift+Right bind[screen_prev] = MOD+Shift+Left bind[mvws_1] = MOD+Shift+ampersand diff --git a/scrotwm_us.conf b/scrotwm_us.conf index accc684..a5b4aed 100644 --- a/scrotwm_us.conf +++ b/scrotwm_us.conf @@ -30,6 +30,8 @@ bind[ws_9] = MOD+9 bind[ws_10] = MOD+0 bind[ws_next] = MOD+Right bind[ws_prev] = MOD+Left +bind[ws_next_all] = MOD+Up +bind[ws_prev_all] = MOD+Down bind[screen_next] = MOD+Shift+Right bind[screen_prev] = MOD+Shift+Left bind[mvws_1] = MOD+Shift+1