diff options
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 3 | ||||
| -rw-r--r-- | patch/include.h | 3 | ||||
| -rw-r--r-- | patch/shiftboth.c | 21 | ||||
| -rw-r--r-- | patch/shiftboth.h | 1 |
4 files changed, 28 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c index 2af5433..a4130da 100644 --- a/patch/include.c +++ b/patch/include.c @@ -232,6 +232,9 @@ #if SETBORDERPX_PATCH #include "setborderpx.c" #endif +#if SHIFTBOTH_PATCH +#include "shiftboth.c" +#endif #if SHIFTTAG_PATCH #include "shifttag.c" #endif diff --git a/patch/include.h b/patch/include.h index eb6b58f..095bd70 100644 --- a/patch/include.h +++ b/patch/include.h @@ -234,6 +234,9 @@ #if SETBORDERPX_PATCH #include "setborderpx.h" #endif +#if SHIFTBOTH_PATCH +#include "shiftboth.h" +#endif #if SHIFTTAG_PATCH #include "shifttag.h" #endif diff --git a/patch/shiftboth.c b/patch/shiftboth.c new file mode 100644 index 0000000..5c7c916 --- /dev/null +++ b/patch/shiftboth.c @@ -0,0 +1,21 @@ +void +shiftboth(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); + view(&shifted); +} diff --git a/patch/shiftboth.h b/patch/shiftboth.h new file mode 100644 index 0000000..7a9b8c2 --- /dev/null +++ b/patch/shiftboth.h @@ -0,0 +1 @@ +static void shiftboth(const Arg *arg); |
