mirror of
https://codeberg.org/frosty/dwm.git
synced 2024-09-19 03:36:55 -04:00
patch: shiftview
This commit is contained in:
parent
6a67c041e5
commit
d5661656c7
|
@ -60,6 +60,8 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
#include "shiftview.c"
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
@ -81,6 +83,8 @@ static const Key keys[] = {
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_y, shiftview, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_y, shiftview, {.i = -1 } },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
|
19
shiftview.c
Normal file
19
shiftview.c
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/** Function to shift the current view to the left/right
|
||||||
|
*
|
||||||
|
* @param: "arg->i" stores the number of tags to shift right (positive value)
|
||||||
|
* or left (negative value)
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
Loading…
Reference in a new issue