summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config.def.h15
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/shifttag.c20
-rw-r--r--patch/shifttag.h1
-rw-r--r--patches.def.h6
6 files changed, 45 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h
index 40c9f46..e4c9f7b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -979,6 +979,10 @@ static Key keys[] = {
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
#endif // VANITYGAPS_PATCH
{ MODKEY, XK_Tab, view, {0} },
+ #if SHIFTTAG_PATCH
+ { MODKEY|ShiftMask, XK_Left, shifttag, { .i = -1 } }, // note keybinding conflict with focusadjacenttag tagtoleft
+ { MODKEY|ShiftMask, XK_Right, shifttag, { .i = +1 } }, // note keybinding conflict with focusadjacenttag tagtoright
+ #endif // SHIFTTAG_PATCH
#if SHIFTVIEW_PATCH
{ MODKEY|ShiftMask, XK_Tab, shiftview, { .i = -1 } },
{ MODKEY|ShiftMask, XK_backslash, shiftview, { .i = +1 } },
@@ -1085,8 +1089,8 @@ static Key keys[] = {
#if FOCUSADJACENTTAG_PATCH
{ MODKEY, XK_Left, viewtoleft, {0} }, // note keybinding conflict with focusdir
{ MODKEY, XK_Right, viewtoright, {0} }, // note keybinding conflict with focusdir
- { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} },
- { MODKEY|ShiftMask, XK_Right, tagtoright, {0} },
+ { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, // note keybinding conflict with shifttag
+ { MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, // note keybinding conflict with shifttag
{ MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} },
{ MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} },
#endif // FOCUSADJACENTTAG_PATCH
@@ -1421,6 +1425,9 @@ static Signal signals[] = {
{ "viewall", viewallex },
{ "viewex", viewex },
{ "toggleview", toggleview },
+ #if SHIFTTAG_PATCH
+ { "shifttag", shifttag },
+ #endif // SHIFTTAG_PATCH
#if SHIFTVIEW_PATCH
{ "shiftview", shiftview },
#endif // SHIFTVIEW_PATCH
@@ -1609,6 +1616,9 @@ static IPCCommand ipccommands[] = {
#if SETBORDERPX_PATCH
IPCCOMMAND( setborderpx, 1, {ARG_TYPE_SINT} ),
#endif // SETBORDERPX_PATCH
+ #if SHIFTTAG_PATCH
+ IPCCOMMAND( shifttag, 1, {ARG_TYPE_SINT} ),
+ #endif // SHIFTVIEW_PATCH
#if SHIFTVIEW_PATCH
IPCCOMMAND( shiftview, 1, {ARG_TYPE_SINT} ),
#endif // SHIFTVIEW_PATCH
@@ -1669,4 +1679,3 @@ static IPCCommand ipccommands[] = {
#endif // XRDB_PATCH
};
#endif // IPC_PATCH
-
diff --git a/patch/include.c b/patch/include.c
index 17f2e81..20ac9df 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -232,6 +232,9 @@
#if SETBORDERPX_PATCH
#include "setborderpx.c"
#endif
+#if SHIFTTAG_PATCH
+#include "shifttag.c"
+#endif
#if SHIFTVIEW_PATCH
#include "shiftview.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 0cf267a..6806b59 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -234,6 +234,9 @@
#if SETBORDERPX_PATCH
#include "setborderpx.h"
#endif
+#if SHIFTTAG_PATCH
+#include "shifttag.h"
+#endif
#if SHIFTVIEW_PATCH
#include "shiftview.h"
#endif
diff --git a/patch/shifttag.c b/patch/shifttag.c
new file mode 100644
index 0000000..97365f1
--- /dev/null
+++ b/patch/shifttag.c
@@ -0,0 +1,20 @@
+/* Sends a window to the next/prev tag */
+void
+shifttag(const Arg *arg)
+{
+ Arg shifted;
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #else
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #endif // SCRATCHPADS_PATCH
+
+ if (arg->i > 0) /* left circular shift */
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (NUMTAGS - arg->i)));
+ else /* right circular shift */
+ shifted.ui = ((shifted.ui >> -arg->i) | (shifted.ui << (NUMTAGS + arg->i)));
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui &= ~SPTAGMASK;
+ #endif // SCRATCHPADS_PATCH
+ tag(&shifted);
+}
diff --git a/patch/shifttag.h b/patch/shifttag.h
new file mode 100644
index 0000000..624787f
--- /dev/null
+++ b/patch/shifttag.h
@@ -0,0 +1 @@
+static void shifttag(const Arg *arg);
diff --git a/patches.def.h b/patches.def.h
index 3cc9756..ec6eab9 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -968,6 +968,12 @@
*/
#define SETBORDERPX_PATCH 0
+/* Moves the current selected client to the adjacent tag.
+ * Also see the focusadjacenttag patch.
+ * https://dwm.suckless.org/patches/shift-tools/
+ */
+#define SHIFTTAG_PATCH 0
+
/* This patch adds keybindings for left and right circular shift through tags.
* https://github.com/chau-bao-long/dotfiles/blob/master/suckless/dwm/shiftview.diff
*/