Skip to content
This repository was archived by the owner on Feb 24, 2021. It is now read-only.

Commit 3e26158

Browse files
committed
Added 'shiftview' functionality
1 parent 130c9e7 commit 3e26158

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ This build contains the following patches:
88
* [tcl](https://dwm.suckless.org/patches/three-column/)
99
* [gaplessgrid](https://dwm.suckless.org/patches/gaplessgrid/)
1010
* [tagall](https://dwm.suckless.org/patches/tagall/)
11+
* [shiftview](https://lists.suckless.org/dev/1104/7590.html)
1112

1213
Including some changes in the config file.

config.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static const char *termcmd[] = { "st", NULL };
7373

7474
#include <X11/XF86keysym.h>
7575
#include "tagall.c"
76+
#include "shiftview.c"
7677

7778
static Key keys[] = {
7879
/* modifier key function argument */
@@ -113,15 +114,20 @@ static Key keys[] = {
113114
TAGKEYS( XK_9, 8)
114115
{ MODKEY|ShiftMask, XK_q, quit, {0} },
115116

116-
{ MODKEY|ShiftMask, XK_F1, tagall, {.v = "1"} },
117-
{ MODKEY|ShiftMask, XK_F2, tagall, {.v = "2"} },
118-
{ MODKEY|ShiftMask, XK_F3, tagall, {.v = "3"} },
119-
{ MODKEY|ShiftMask, XK_F4, tagall, {.v = "4"} },
120-
{ MODKEY|ShiftMask, XK_F5, tagall, {.v = "5"} },
121-
{ MODKEY|ShiftMask, XK_F6, tagall, {.v = "6"} },
122-
{ MODKEY|ShiftMask, XK_F7, tagall, {.v = "7"} },
123-
{ MODKEY|ShiftMask, XK_F8, tagall, {.v = "8"} },
124-
{ MODKEY|ShiftMask, XK_F9, tagall, {.v = "9"} },
117+
/* 'tagall' shortcuts */
118+
{ MODKEY|ShiftMask, XK_F1, tagall, {.v = "1"} },
119+
{ MODKEY|ShiftMask, XK_F2, tagall, {.v = "2"} },
120+
{ MODKEY|ShiftMask, XK_F3, tagall, {.v = "3"} },
121+
{ MODKEY|ShiftMask, XK_F4, tagall, {.v = "4"} },
122+
{ MODKEY|ShiftMask, XK_F5, tagall, {.v = "5"} },
123+
{ MODKEY|ShiftMask, XK_F6, tagall, {.v = "6"} },
124+
{ MODKEY|ShiftMask, XK_F7, tagall, {.v = "7"} },
125+
{ MODKEY|ShiftMask, XK_F8, tagall, {.v = "8"} },
126+
{ MODKEY|ShiftMask, XK_F9, tagall, {.v = "9"} },
127+
128+
/* 'shiftview' shortcuts */
129+
{ MODKEY, XK_Page_Up, shiftview, {.i = -1} },
130+
{ MODKEY, XK_Page_Down, shiftview, {.i = -1} },
125131

126132
{ 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Master toggle")},
127133
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer sset Master 5%+")},

shiftview.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** Function to shift the current view to the left/right
2+
*
3+
* @param: "arg->i" stores the number of tags to shift right (positive value)
4+
* or left (negative value)
5+
*/
6+
void
7+
shiftview(const Arg *arg) {
8+
Arg shifted;
9+
10+
if(arg->i > 0) // left circular shift
11+
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
12+
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
13+
14+
else // right circular shift
15+
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
16+
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
17+
18+
view(&shifted);
19+
}

0 commit comments

Comments
 (0)