add change tabs on win-(shift)-tab

This commit is contained in:
Linux User 2022-08-14 22:20:07 +00:00
parent 0fbc7a7bb0
commit 36973c8e08
5 changed files with 31 additions and 6 deletions

View File

@ -26,7 +26,7 @@ static const char *colors[][3] = {
};
/* tagging */
static const char *tags[] = { "", "", "3", "4", "5", "6", "7", "8", "" };
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
static const Rule rules[] = {
/* xprop(1):
@ -80,7 +80,9 @@ static Key keys[] = {
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {.i = +1} },
{ MODKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ MODKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ MODKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },

View File

@ -26,7 +26,7 @@ static const char *colors[][3] = {
};
/* tagging */
static const char *tags[] = { "", "", "3", "4", "5", "6", "7", "8", "" };
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
static const Rule rules[] = {
/* xprop(1):
@ -80,7 +80,9 @@ static Key keys[] = {
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {.i = +1} },
{ MODKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ MODKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ MODKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },

BIN
dwm

Binary file not shown.

25
dwm.c
View File

@ -2045,9 +2045,30 @@ view(const Arg *arg)
{
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK)
if (arg->ui != -2)
selmon->tagset[selmon->seltags ^ 1] = selmon->tagset[selmon->seltags];
if (arg->ui == 0) {
if (selmon->tagset[selmon->seltags] << 1 > TAGMASK)
selmon->tagset[selmon->seltags] = 1;
else
selmon->tagset[selmon->seltags] <<= 1;
}
else if (arg->ui == -1) {
if (selmon->tagset[selmon->seltags] >> 1 < 1)
selmon->tagset[selmon->seltags] = (TAGMASK + 1) >> 1;
else
selmon->tagset[selmon->seltags] >>= 1;
}
else if (arg->ui == -2) {
selmon->tagset[selmon->seltags] += selmon->tagset[selmon->seltags ^ 1];
selmon->tagset[selmon->seltags ^ 1] = selmon->tagset[selmon->seltags] - selmon->tagset[selmon->seltags ^ 1];
selmon->tagset[selmon->seltags] -= selmon->tagset[selmon->seltags ^ 1];
}
else if (arg->ui & TAGMASK)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
focus(NULL);
arrange(selmon);
}

BIN
dwm.o

Binary file not shown.