summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 0fba3dc..121aa44 100644
--- a/dwm.c
+++ b/dwm.c
@@ -209,6 +209,8 @@ static void sigchld(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
+static void tagtoleft(const Arg *arg);
+static void tagtoright(const Arg *arg);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
@@ -228,6 +230,8 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void viewtoleft(const Arg *arg);
+static void viewtoright(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -1854,6 +1858,28 @@ updateclientlist()
(unsigned char *) &(c->win), 1);
}
+void
+tagtoleft(const Arg *arg) {
+ if(selmon->sel != NULL
+ && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->sel->tags >>= 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+tagtoright(const Arg *arg) {
+ if(selmon->sel != NULL
+ && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->sel->tags <<= 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
int
updategeom(void)
{
@@ -2051,6 +2077,28 @@ view(const Arg *arg)
arrange(selmon);
}
+void
+viewtoleft(const Arg *arg) {
+ if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+viewtoright(const Arg *arg) {
+ if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
Client *
wintoclient(Window w)
{