apply 'skipfocus'

This commit is contained in:
Stachelbeere1248 2025-02-17 19:41:06 +01:00
parent 71dd023220
commit d904922b52
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
2 changed files with 21 additions and 9 deletions

View file

@ -22,10 +22,11 @@ static int log_level = WLR_ERROR;
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */ /* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = { static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */ /* app_id title tags mask isfloating skipfocus monitor */
/* examples: */ /* examples: */
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */ { "Gimp_EXAMPLE", NULL, 0, 1, 0, -1 }, /* Start on currently visible tags floating, not tiled */
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 0, -1 }, /* Start on ONLY tag "9" */
{ "mako_EXAMPLE", NULL, 0, 1, 1, -1 }, /* Start floating and skip focus
}; };
/* layout(s) */ /* layout(s) */

23
dwl.c
View file

@ -139,7 +139,7 @@ typedef struct {
#endif #endif
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen, skipfocus;
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@ -230,6 +230,7 @@ typedef struct {
const char *title; const char *title;
uint32_t tags; uint32_t tags;
int isfloating; int isfloating;
int skipfocus;
int monitor; int monitor;
} Rule; } Rule;
@ -470,6 +471,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title)) if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) { && (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->skipfocus = r->skipfocus;
newtags |= r->tags; newtags |= r->tags;
i = 0; i = 0;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@ -1347,6 +1349,13 @@ focusclient(Client *c, int lift)
if (locked) if (locked)
return; return;
if (c && c->skipfocus != 0){
if (c -> skipfocus == 1) {
c->skipfocus = 0;
}
return;
}
/* Raise client in stacking order if requested */ /* Raise client in stacking order if requested */
if (c && lift) if (c && lift)
wlr_scene_node_raise_to_top(&c->scene->node); wlr_scene_node_raise_to_top(&c->scene->node);
@ -1741,11 +1750,13 @@ mapnotify(struct wl_listener *listener, void *data)
printstatus(); printstatus();
unset_fullscreen: unset_fullscreen:
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); if (!c->skipfocus) {
wl_list_for_each(w, &clients, link) { m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags)) wl_list_for_each(w, &clients, link) {
setfullscreen(w, 0); if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags))
} setfullscreen(w, 0);
}
}
} }
void void