commit ab1aaf19346098d951a29fc303b5d4310d45da9e
parent 9cd20ae3a19a6e1b3e010c6156a564f55f3f27ad
Author: Miles Alan <m@milesalan.com>
Date: Sat, 18 Apr 2020 18:56:57 -0500
Cleanup code and config related to shiftview/clienttagpush
Diffstat:
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -67,9 +67,9 @@ static Key keys[] = {
{0, MODKEY, XK_0, view, {.ui = ~0 } },
{0, MODKEY|ShiftMask, XK_h, shiftview, {.i = -1} },
- {0, MODKEY|ShiftMask, XK_l, tagtoright, {.i = +1} },
- {0, MODKEY, XK_h, tagtoright, {0} },
- {0, MODKEY, XK_l, tagtoright, {0} },
+ {0, MODKEY|ShiftMask, XK_l, shiftview, {.i = +1} },
+ {0, MODKEY, XK_h, clienttagpush, {.i = -1} },
+ {0, MODKEY, XK_l, clienttagpush, {.i = +1} },
{1, 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sxmo_appmenu.sh") },
{2, 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sxmo_appmenu.sh sys") },
@@ -92,7 +92,6 @@ static Button buttons[] = {
/* click event mask button function argument */
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1} },
- { ClkWinTitle, 0, Button1, tagtoright, {0} },
{ ClkStatusText, 0, Button1, spawn, SHCMD("sxmo_appmenu.sh control") },
};
diff --git a/dwm.c b/dwm.c
@@ -249,7 +249,8 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
static void bstack(Monitor *m);
static void bstackhoriz(Monitor *m);
-static void tagtoright(const Arg *arg);
+static void clienttagpush(const Arg *arg);
+static void shiftview(const Arg *arg);
static pid_t getparentprocess(pid_t p);
static int isdescprocess(pid_t p, pid_t c);
@@ -2590,17 +2591,25 @@ bstackhoriz(Monitor *m) {
}
void
-tagtoright(const Arg *arg) {
+clienttagpush(const Arg *arg) {
if (selmon->sel == NULL) return;
- if (
- (selmon->tagset[selmon->seltags] & TAGMASK)
- && (selmon->tagset[selmon->seltags] & (TAGMASK >> 1))
- ) {
- selmon->sel->tags <<= 1;
+ if (arg->i > 0) {
+ if (
+ (selmon->tagset[selmon->seltags] & TAGMASK)
+ && (selmon->tagset[selmon->seltags] & (TAGMASK >> 1))
+ ) {
+ selmon->sel->tags <<= 1;
+ }
} else {
- selmon->sel->tags = 1 << 0;
+ if (
+ (selmon->tagset[selmon->seltags] & TAGMASK)
+ && (selmon->tagset[selmon->seltags] & (TAGMASK << 1))
+ ) {
+ selmon->sel->tags >>= 1;
+ }
}
+
focus(NULL);
arrange(selmon);
}
@@ -2609,11 +2618,11 @@ void
shiftview(const Arg *arg) {
Arg shifted;
- if(arg->i > 0) // left circular shift
+ if(arg->i > 0)
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
- else // right circular shift
+ else
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);