diff --git a/config.def.h b/config.def.h index 5375eb5..4dcfa49 100644 --- a/config.def.h +++ b/config.def.h @@ -13,6 +13,13 @@ static const float urgentcolor[] = COLOR(0xff0000ff); /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ +enum { + VIEW_L = -1, + VIEW_R = 1, + SHIFT_L = -2, + SHIFT_R = 2, +} RotateTags; + /* tagging - TAGCOUNT must be no greater than 31 */ #define TAGCOUNT (9) @@ -124,7 +131,11 @@ static const Key keys[] = { { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, - { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_i, incnmaster, {.i = -1} }, + { MODKEY, XKB_KEY_a, rotatetags, {.i = VIEW_L} }, + { MODKEY, XKB_KEY_d, rotatetags, {.i = VIEW_R} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_a, rotatetags, {.i = SHIFT_L} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_d, rotatetags, {.i = SHIFT_R} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, { MODKEY, XKB_KEY_Return, zoom, {0} }, diff --git a/dwl.c b/dwl.c index 51e4fac..fa9a039 100644 --- a/dwl.c +++ b/dwl.c @@ -327,6 +327,7 @@ static Monitor *xytomon(double x, double y); static void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, LayerSurface **pl, double *nx, double *ny); static void zoom(const Arg *arg); +static void rotatetags(const Arg *arg); /* variables */ static const char broken[] = "broken"; @@ -2739,6 +2740,34 @@ zoom(const Arg *arg) arrange(selmon); } +static void +rotatetags(const Arg *arg) +{ + Arg newarg; + int i = arg->i; + int nextseltags = 0, curseltags = selmon->tagset[selmon->seltags]; + bool shift = false; + + switch(abs(i)) { + default: break; + case SHIFT_R: + shift = true; + break; + }; + + if (i > 0) + nextseltags = (curseltags << 1) | (curseltags >> (TAGCOUNT - 1)); + else + nextseltags = (curseltags >> 1) | (curseltags << (TAGCOUNT - 1)); + + newarg.i = nextseltags; + + if (shift) { + tag(&newarg); + } else + view(&newarg); +} + #ifdef XWAYLAND void activatex11(struct wl_listener *listener, void *data)