ekzyis 2024-04-21 09:33:01 +02:00
parent 23ee07788c
commit dcc5981499
2 changed files with 29 additions and 1 deletions

View File

@ -76,7 +76,9 @@ static const Key keys[] = {
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
// { MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
// { MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_Tab, cycletags, { .i = +1 } },
{ MODKEY|ShiftMask, XK_Tab, cycletags, { .i = -1 } },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },

26
dwm.c
View File

@ -157,6 +157,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
static void cycletags(const Arg *arg);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@ -647,6 +648,31 @@ createmon(void)
return m;
}
void
cycletags(const Arg *arg)
{
Arg shifted;
Client *c;
unsigned int tagmask = 0;
for (c = selmon->clients; c; c = c->next)
tagmask = tagmask | c->tags;
shifted.ui = selmon->tagset[selmon->seltags];
if (arg->i > 0) // left circular shift
do {
shifted.ui = (shifted.ui << arg->i)
| (shifted.ui >> (LENGTH(tags) - arg->i));
} while (tagmask && !(shifted.ui & tagmask));
else // right circular shift
do {
shifted.ui = (shifted.ui >> (- arg->i)
| shifted.ui << (LENGTH(tags) + arg->i));
} while (tagmask && !(shifted.ui & tagmask));
view(&shifted);
}
void
destroynotify(XEvent *e)
{