summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-09-01 19:40:42 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-09-01 19:40:42 +0900
commit0dd666a626964ab58334f52a6c548179e7ede0fe (patch)
tree783d81e15953bceb0f02ce5d18062a47c837a873
parent3adf2a23e0d600c3552c7f82ef0e312c8b3579cc (diff)
Init
-rw-r--r--dwm/config.h2
-rw-r--r--dwm/shift-tools-scratchpads.c19
2 files changed, 21 insertions, 0 deletions
diff --git a/dwm/config.h b/dwm/config.h
index 43f7760..8eb11e5 100644
--- a/dwm/config.h
+++ b/dwm/config.h
@@ -407,6 +407,8 @@ static const Key keys[] = {
{ MODKEY2, XK_bracketright, shiftview, { .i = 1 } },
{ MODKEY2 | ShiftMask, XK_bracketleft, shifttag, { .i = -1 } },
{ MODKEY2 | ShiftMask, XK_bracketright, shifttag, { .i = 1 } },
+ { MODKEY2 | ControlMask, XK_bracketleft, shifttagandview, { .i = -1 } },
+ { MODKEY2 | ControlMask, XK_bracketright, shifttagandview, { .i = 1 } },
{ MODKEY, XK_bracketleft, shiftviewclients, { .i = -1 } },
{ MODKEY, XK_bracketright, shiftviewclients, { .i = +1 } },
{ MODKEY | ShiftMask, XK_bracketleft, shifttagclients, { .i = -1 } },
diff --git a/dwm/shift-tools-scratchpads.c b/dwm/shift-tools-scratchpads.c
index 1e399a8..a8e15d8 100644
--- a/dwm/shift-tools-scratchpads.c
+++ b/dwm/shift-tools-scratchpads.c
@@ -85,6 +85,25 @@ shiftviewclients(const Arg *arg)
} while (tagmask && !(shifted.ui & tagmask));
view(&shifted);
}
+/* Shift the active window to the next/prev tag and view it */
+void
+shifttagandview(const Arg *arg)
+{
+ Arg shifted;
+ shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
+
+ if (arg->i > 0) { /* Left circular shift */
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i))) & ~SPTAGMASK;
+ } else { /* Right circular shift */
+ shifted.ui = ((shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i))) & ~SPTAGMASK;
+ }
+
+ /* Shift the window to the calculated tag */
+ tag(&shifted);
+
+ /* View the tag that we just shifted to */
+ view(&shifted);
+}
/* move the current active window to the next/prev tag and view it. More like following the window */
void
shiftboth(const Arg *arg)