Port switchtotag

Adds a rule option to switch to the configured tag when a window opens,
then switch back when it closes.
This commit is contained in:
Guido Cella 2023-05-03 09:38:59 +02:00
parent 960c32a7d8
commit 9311c56fb0
2 changed files with 14 additions and 3 deletions

11
dwl.c
View file

@ -125,6 +125,7 @@ typedef struct {
unsigned int bw;
uint32_t tags;
int isfloating, isurgent, isfullscreen;
int switchtotag;
uint32_t resize; /* configure serial of a pending resize */
} Client;
@ -207,6 +208,7 @@ typedef struct {
const char *id;
const char *title;
uint32_t tags;
bool switchtotag;
int isfloating;
int monitor;
} Rule;
@ -465,6 +467,11 @@ applyrules(Client *c)
wl_list_for_each(m, &mons, link)
if (r->monitor == i++)
mon = m;
if (r->switchtotag) {
c->switchtotag = selmon->tagset[selmon->seltags];
mon->seltags ^= 1;
mon->tagset[selmon->seltags] = r->tags & TAGMASK;
}
}
}
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
@ -2486,6 +2493,10 @@ unmapnotify(struct wl_listener *listener, void *data)
wlr_scene_node_destroy(&c->scene->node);
printstatus();
motionnotify(0);
if (c->switchtotag) {
Arg a = { .ui = c->switchtotag };
view(&a);
}
}
void