summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h2
-rw-r--r--dwm.c16
2 files changed, 18 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 2ce9af2..ca100bd 100644
--- a/config.def.h
+++ b/config.def.h
@@ -89,6 +89,8 @@ static Key keys[] = {
{ MODKEY, XK_space, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_equal, incnmaster, {.i = +1 } },
{ MODKEY|ShiftMask, XK_minus, incnmaster, {.i = -1 } },
+ { MODKEY, XK_l, shiftview, {.i = +1 } },
+ { MODKEY, XK_h, shiftview, {.i = -1 } },
{ MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} },
{ MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
diff --git a/dwm.c b/dwm.c
index 5e2fc17..046b8bf 100644
--- a/dwm.c
+++ b/dwm.c
@@ -254,6 +254,7 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void shiftview(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -2399,6 +2400,21 @@ view(const Arg *arg)
arrange(selmon);
}
+void
+shiftview(const Arg *arg) {
+ Arg shifted;
+
+ if(arg->i > 0) // left circular shift
+ shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
+ | (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
+
+ else // right circular shift
+ shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
+ | selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
+
+ view(&shifted);
+}
+
pid_t
winpid(Window w)
{