diff --git a/README.md b/README.md index 63aadfa..8d88cb0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2020-01-29 - Added swapfocus patch +2020-01-29 - Added swapfocus and shiftview patches 2020-01-26 - Added transfer patch @@ -272,6 +272,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [setborderpx](https://dwm.suckless.org/patches/statuspadding/) - this patch allows border pixels to be changed during runtime + - [shiftview](https://github.com/chau-bao-long/dotfiles/blob/master/suckless/dwm/shiftview.diff) + - adds keybindings for left and right circular shift through tags + - also see focusadjacenttag + - [sortscreens](https://www.mail-archive.com/hackers@suckless.org/msg09400.html) - this patch aims to address some inconsistencies when it comes to focusmon, tagmon and similar functionality by explicitly sorting screens left to right (or top to bottom in a vertical layout) diff --git a/config.def.h b/config.def.h index 83e5192..1388ca7 100644 --- a/config.def.h +++ b/config.def.h @@ -585,6 +585,10 @@ static Key keys[] = { { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, #endif // VANITYGAPS_PATCH { MODKEY, XK_Tab, view, {0} }, + #if SHIFTVIEW_PATCH + { MODKEY|ShiftMask, XK_Tab, shiftview, { .i = -1 } }, + { MODKEY|ShiftMask, XK_backslash, shiftview, { .i = +1 } }, + #endif // SHIFTVIEW_PATCH #if AWESOMEBAR_PATCH { MODKEY, XK_z, showhideclient, {0} }, #endif // AWESOMEBAR_PATCH diff --git a/patch/include.c b/patch/include.c index 8a404e1..737bdc1 100644 --- a/patch/include.c +++ b/patch/include.c @@ -88,6 +88,9 @@ #if SETBORDERPX_PATCH #include "setborderpx.c" #endif +#if SHIFTVIEW_PATCH +#include "shiftview.c" +#endif #if SORTSCREENS_PATCH #ifdef XINERAMA #include "sortscreens.c" diff --git a/patch/include.h b/patch/include.h index 5ef2291..8406e37 100644 --- a/patch/include.h +++ b/patch/include.h @@ -88,6 +88,9 @@ #if SETBORDERPX_PATCH #include "setborderpx.h" #endif +#if SHIFTVIEW_PATCH +#include "shiftview.h" +#endif #if SORTSCREENS_PATCH #ifdef XINERAMA #include "sortscreens.h" diff --git a/patch/shiftview.c b/patch/shiftview.c new file mode 100644 index 0000000..7e1a7a0 --- /dev/null +++ b/patch/shiftview.c @@ -0,0 +1,15 @@ +void +shiftview(const Arg *arg) +{ + Arg shifted; + + if(arg->i > 0) // left circular shift + shifted.ui = (selmon->tagset[selmon->seltags] << arg->i) + | (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i)); + + else // right circular shift + shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i) + | selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i); + + view(&shifted); +} \ No newline at end of file diff --git a/patch/shiftview.h b/patch/shiftview.h new file mode 100644 index 0000000..cace70e --- /dev/null +++ b/patch/shiftview.h @@ -0,0 +1 @@ +static void shiftview(const Arg *arg); \ No newline at end of file diff --git a/patches.def.h b/patches.def.h index 4ce253e..9db3bb2 100644 --- a/patches.def.h +++ b/patches.def.h @@ -389,6 +389,11 @@ */ #define SETBORDERPX_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 + */ +#define SHIFTVIEW_PATCH 0 + /* In a multi-head setup monitor 0 is by default the primary screen, with the left and right * screen being monitor 1 and 2 respectively. This patch sorts screens left to right (or * top to bottom in a vertical layout) which aims to address some inconsistencies when it