apply singletagset patch
parent
6213cb83d0
commit
d436530ed3
88
dwl.c
88
dwl.c
|
|
@ -236,6 +236,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
|||
struct wlr_box *usable_area, int exclusive);
|
||||
static void arrangelayers(Monitor *m);
|
||||
static void autostartexec(void);
|
||||
static void attachclients(Monitor *m);
|
||||
static void axisnotify(struct wl_listener *listener, void *data);
|
||||
static void buttonpress(struct wl_listener *listener, void *data);
|
||||
static void chvt(const Arg *arg);
|
||||
|
|
@ -281,6 +282,7 @@ static void focusstack(const Arg *arg);
|
|||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void handlesig(int signo);
|
||||
static size_t getunusedtag(void);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||
|
|
@ -601,6 +603,15 @@ autostartexec(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
attachclients(Monitor *m)
|
||||
{
|
||||
Client *c;
|
||||
wl_list_for_each(c, &clients, link)
|
||||
if (c->tags & m->tagset[m->seltags])
|
||||
setmon(c, m, c->tags);
|
||||
}
|
||||
|
||||
void
|
||||
axisnotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -969,7 +980,7 @@ createmon(struct wl_listener *listener, void *data)
|
|||
/* Initialize monitor state using configured rules */
|
||||
for (i = 0; i < LENGTH(m->layers); i++)
|
||||
wl_list_init(&m->layers[i]);
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
m->tagset[0] = m->tagset[1] = (1<<getunusedtag()) & TAGMASK;
|
||||
for (r = monrules; r < END(monrules); r++) {
|
||||
if (!r->name || strstr(wlr_output->name, r->name)) {
|
||||
m->mfact = r->mfact;
|
||||
|
|
@ -1575,6 +1586,22 @@ fullscreennotify(struct wl_listener *listener, void *data)
|
|||
setfullscreen(c, client_wants_fullscreen(c));
|
||||
}
|
||||
|
||||
size_t
|
||||
getunusedtag(void)
|
||||
{
|
||||
size_t i = 0;
|
||||
Monitor *m;
|
||||
if (wl_list_empty(&mons))
|
||||
return i;
|
||||
for (i=0; i < tagcount; i++) {
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (!(m->tagset[m->seltags] & (1<<i)))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void
|
||||
handlesig(int signo)
|
||||
{
|
||||
|
|
@ -2114,8 +2141,6 @@ printstatus(void)
|
|||
wl_list_for_each(m, &mons, link) {
|
||||
occ = urg = 0;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
|
|
@ -2608,22 +2633,32 @@ startdrag(struct wl_listener *listener, void *data)
|
|||
void
|
||||
tag(const Arg *arg)
|
||||
{
|
||||
Monitor *m;
|
||||
Client *sel = focustop(selmon);
|
||||
if (!sel || (arg->ui & TAGMASK) == 0)
|
||||
return;
|
||||
|
||||
sel->tags = arg->ui & TAGMASK;
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
attachclients(m);
|
||||
arrange(m);
|
||||
}
|
||||
printstatus();
|
||||
}
|
||||
|
||||
void
|
||||
tagmon(const Arg *arg)
|
||||
{
|
||||
Monitor *m;
|
||||
Client *sel = focustop(selmon);
|
||||
if (sel)
|
||||
if (sel) {
|
||||
setmon(sel, dirtomon(arg->i), 0);
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
arrange(m);
|
||||
}
|
||||
focusclient(focustop(sel->mon), 1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -2686,6 +2721,7 @@ togglefullscreen(const Arg *arg)
|
|||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
Monitor *m;
|
||||
uint32_t newtags;
|
||||
Client *sel = focustop(selmon);
|
||||
if (!sel)
|
||||
|
|
@ -2694,7 +2730,12 @@ toggletag(const Arg *arg)
|
|||
if (!newtags)
|
||||
return;
|
||||
|
||||
wl_list_for_each(m, &mons, link)
|
||||
if (m !=selmon && newtags & m->tagset[m->seltags])
|
||||
return;
|
||||
|
||||
sel->tags = newtags;
|
||||
attachclients(selmon);
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
|
|
@ -2703,12 +2744,18 @@ toggletag(const Arg *arg)
|
|||
void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
Monitor *m;
|
||||
uint32_t newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0;
|
||||
|
||||
if (!newtagset)
|
||||
return;
|
||||
|
||||
wl_list_for_each(m, &mons, link)
|
||||
if (m !=selmon && newtagset & m->tagset[m->seltags])
|
||||
return;
|
||||
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
attachclients(selmon);
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
|
|
@ -2877,13 +2924,36 @@ urgent(struct wl_listener *listener, void *data)
|
|||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
Monitor *m, *origm = selmon;
|
||||
unsigned int newtags = selmon->tagset[selmon->seltags ^ 1];
|
||||
|
||||
if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
|
||||
/* swap tags when trying to display a tag from another monitor */
|
||||
if (arg->ui & TAGMASK)
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
newtags = arg->ui & TAGMASK;
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (m != selmon && newtags & m->tagset[m->seltags]) {
|
||||
/* prevent displaying all tags (MODKEY-0) when multiple monitors
|
||||
* are connected */
|
||||
if (newtags & selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
m->seltags ^= 1;
|
||||
m->tagset[m->seltags] = selmon->tagset[selmon->seltags];
|
||||
attachclients(m);
|
||||
focusclient(focustop(m), 1);
|
||||
arrange(m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
origm->seltags ^= 1; /* toggle sel tagset */
|
||||
if (arg->ui & TAGMASK)
|
||||
origm->tagset[origm->seltags] = arg->ui & TAGMASK;
|
||||
attachclients(origm);
|
||||
focusclient(focustop(origm), 1);
|
||||
arrange(origm);
|
||||
printstatus();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue