Add shortcuts to move tag selection
This commit is contained in:
parent
d5e58baff8
commit
cef2566f82
|
@ -74,6 +74,8 @@ static Key keys[] = {
|
|||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_h, viewrel, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_l, viewrel, {.i = +1 } },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
|
|
44
dwm.c
44
dwm.c
|
@ -264,6 +264,7 @@ static void updatetitle(Client *c);
|
|||
static void updatewindowtype(Client *c);
|
||||
static void updatewmhints(Client *c);
|
||||
static void view(const Arg *arg);
|
||||
static void viewrel(const Arg *arg);
|
||||
static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
static Client *wintosystrayicon(Window w);
|
||||
|
@ -2708,6 +2709,49 @@ view(const Arg *arg)
|
|||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
viewrel(const Arg *arg)
|
||||
{
|
||||
const int shift = arg->i;
|
||||
|
||||
if (shift == 0) return;
|
||||
|
||||
const unsigned int old_tagset = selmon->tagset[selmon->seltags] & TAGMASK;
|
||||
const unsigned int new_tagset = (shift > 0 ? (old_tagset << shift) : (old_tagset >> (-shift))) & TAGMASK;
|
||||
|
||||
if (new_tagset == old_tagset) return;
|
||||
|
||||
if (new_tagset == 0) {
|
||||
unsigned int tmptag = selmon->pertag->prevtag;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = tmptag;
|
||||
} else {
|
||||
selmon->tagset[selmon->seltags] = new_tagset;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
|
||||
if (new_tagset == (~0 & TAGMASK)) {
|
||||
selmon->pertag->curtag = 0;
|
||||
} else {
|
||||
int i = 0;
|
||||
while (!(new_tagset & 1 << i)) ++i;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) {
|
||||
togglebar(NULL);
|
||||
}
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
Client *
|
||||
wintoclient(Window w)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue