super+shift+g/; to send to prev/next window

i'll merge the functions later maybe lol
This commit is contained in:
Luke Smith 2020-05-03 16:08:23 -04:00
parent 8cd6c7f0ea
commit 01231194cc
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
3 changed files with 38 additions and 6 deletions

View file

@ -164,12 +164,12 @@ static Key keys[] = {
{ MODKEY, XK_f, togglefullscr, {0} }, { MODKEY, XK_f, togglefullscr, {0} },
{ MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[8]} }, { MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[8]} },
{ MODKEY, XK_g, shiftview, { .i = -1 } }, { MODKEY, XK_g, shiftview, { .i = -1 } },
/* { MODKEY|ShiftMask, XK_g, shifttag, { .i = -1 } }, */ { MODKEY|ShiftMask, XK_g, shifttag, { .i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_h, setmfact, {.f = -0.05} },
/* J and K are automatically bound above in STACKEYS */ /* J and K are automatically bound above in STACKEYS */
{ MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_semicolon, shiftview, { .i = 1 } }, { MODKEY, XK_semicolon, shiftview, { .i = 1 } },
/* { MODKEY|ShiftMask, XK_semicolon, shifttag, { .i = 1 } }, */ { MODKEY|ShiftMask, XK_semicolon, shifttag, { .i = 1 } },
{ MODKEY, XK_apostrophe, togglescratch, {.ui = 1} }, { MODKEY, XK_apostrophe, togglescratch, {.ui = 1} },
/* { MODKEY|ShiftMask, XK_apostrophe, spawn, SHCMD("") }, */ /* { MODKEY|ShiftMask, XK_apostrophe, spawn, SHCMD("") }, */
{ MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } },
@ -200,9 +200,9 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_Right, tagmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_Right, tagmon, {.i = +1 } },
{ MODKEY, XK_Page_Up, shiftview, { .i = -1 } }, { MODKEY, XK_Page_Up, shiftview, { .i = -1 } },
/* { MODKEY|ShiftMask, XK_Page_Up, shifttag, { .i = -1 } }, */ { MODKEY|ShiftMask, XK_Page_Up, shifttag, { .i = -1 } },
{ MODKEY, XK_Page_Down, shiftview, { .i = +1 } }, { MODKEY, XK_Page_Down, shiftview, { .i = +1 } },
/* { MODKEY|ShiftMask, XK_Page_Down, shifttag, { .i = +1 } }, */ { MODKEY|ShiftMask, XK_Page_Down, shifttag, { .i = +1 } },
{ MODKEY, XK_Insert, spawn, SHCMD("notify-send \"📋 Clipboard contents:\" \"$(xclip -o -selection clipboard)\"") }, { MODKEY, XK_Insert, spawn, SHCMD("notify-send \"📋 Clipboard contents:\" \"$(xclip -o -selection clipboard)\"") },
{ MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") }, { MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") },

View file

@ -244,9 +244,9 @@ There are nine tags, active tags are highlighted in the top left.
.ITEM .ITEM
\f(CWMod+Tab\fP \(en Go to previous tag (may also use \f(CW\\\fP for Tab) \f(CWMod+Tab\fP \(en Go to previous tag (may also use \f(CW\\\fP for Tab)
.ITEM .ITEM
\f(CWMod+g\fP \(en Go to left tag \f(CWMod+g\fP \(en Go to left tag (hold shift to send window there)
.ITEM .ITEM
\f(CWMod+;\fP \(en Go to right tag \f(CWMod+;\fP \(en Go to right tag (hold shift to send window there)
.ITEM .ITEM
\f(CWMod+Left\fP \(en Move to workspace to the left \f(CWMod+Left\fP \(en Move to workspace to the left
.ITEM .ITEM

View file

@ -34,3 +34,35 @@ shiftview(const Arg *arg)
view(&a); view(&a);
} }
} }
void
shifttag(const Arg *arg)
{
Arg a;
Client *c;
unsigned visible = 0;
int i = arg->i;
int count = 0;
int nextseltags, curseltags = selmon->tagset[selmon->seltags];
do {
if(i > 0) // left circular shift
nextseltags = (curseltags << i) | (curseltags >> (LENGTH(tags) - i));
else // right circular shift
nextseltags = curseltags >> (- i) | (curseltags << (LENGTH(tags) + i));
// Check if tag is visible
for (c = selmon->clients; c && !visible; c = c->next)
if (nextseltags & c->tags) {
visible = 1;
break;
}
i += arg->i;
} while (!visible && ++count < 10);
if (count < 10) {
a.i = nextseltags;
tag(&a);
}
}