mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-01-30 04:37:28 -08:00
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:
parent
960c32a7d8
commit
9311c56fb0
2 changed files with 14 additions and 3 deletions
|
@ -12,11 +12,11 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
|
|||
static const int tagcount = TAGCOUNT;
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
/* app_id title tags mask switchtotag isfloating monitor */
|
||||
/* examples:
|
||||
{ "Gimp", NULL, 0, 1, -1 },
|
||||
{ "Gimp", NULL, 0, 0, 1, -1 },
|
||||
{ "firefox", NULL, 1 << 8, 1, 0, -1 },
|
||||
*/
|
||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
|
|
11
dwl.c
11
dwl.c
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue