From 0dd666a626964ab58334f52a6c548179e7ede0fe Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sun, 1 Sep 2024 19:40:42 +0900 Subject: Init --- dwm/config.h | 2 ++ dwm/shift-tools-scratchpads.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) 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) -- cgit v1.2.3