fix client ignore_tag rule not beeing applied
This commit is contained in:
commit
8d2f2937a4
62
src/client.c
62
src/client.c
@ -847,6 +847,34 @@ client_frame_new(struct client *c)
|
||||
XReparentWindow(W->dpy, c->win, c->frame, c->border, c->tbarw);
|
||||
}
|
||||
|
||||
static void
|
||||
_apply_rule(struct client *c, struct rule *r)
|
||||
{
|
||||
if(r->screen != -1)
|
||||
c->screen = screen_gb_id(r->screen);
|
||||
|
||||
c->tag = c->screen->seltag;
|
||||
if(r->tag != -1)
|
||||
c->tag = tag_gb_id(c->screen, r->tag);
|
||||
|
||||
c->theme = r->theme;
|
||||
|
||||
/* free = false for originally free client */
|
||||
if(r->flags & RULE_FREE)
|
||||
c->flags |= CLIENT_FREE;
|
||||
else
|
||||
c->flags &= ~CLIENT_FREE;
|
||||
|
||||
/* Free rule is not compatible with tab rule */
|
||||
if(r->flags & RULE_TAB)
|
||||
W->flags ^= WMFS_TABNOC; /* < can be disable by client_tab_next_opened */
|
||||
|
||||
if(r->flags & RULE_IGNORE_TAG)
|
||||
c->flags |= CLIENT_IGNORE_TAG;
|
||||
|
||||
c->flags |= CLIENT_RULED;
|
||||
}
|
||||
|
||||
#define RINSTANCE 0x01
|
||||
#define RCLASS 0x02
|
||||
#define RROLE 0x04
|
||||
@ -855,6 +883,7 @@ static void
|
||||
client_apply_rule(struct client *c)
|
||||
{
|
||||
struct rule *r;
|
||||
struct rule *defaultr = NULL;
|
||||
char *wmname = NULL;
|
||||
char *role = NULL;
|
||||
int f;
|
||||
@ -883,8 +912,11 @@ client_apply_rule(struct client *c)
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
/* Apply a specific rule */
|
||||
SLIST_FOREACH(r, &W->h.rule, next)
|
||||
{
|
||||
if (r->instance && !strcmp(r->instance, "*"))
|
||||
defaultr = r;
|
||||
if(s)
|
||||
{
|
||||
FLAGAPPLY(flags, (xch.res_name && r->instance && !strcmp(xch.res_name, r->instance)), RINSTANCE);
|
||||
@ -895,31 +927,7 @@ client_apply_rule(struct client *c)
|
||||
FLAGAPPLY(flags, ((role && r->role && !strcmp(role, r->role)) || !role || !r->role), RROLE);
|
||||
|
||||
if(flags & (RINSTANCE | RCLASS | RNAME) && flags & RROLE)
|
||||
{
|
||||
if(r->screen != -1)
|
||||
c->screen = screen_gb_id(r->screen);
|
||||
|
||||
c->tag = c->screen->seltag;
|
||||
if(r->tag != -1)
|
||||
c->tag = tag_gb_id(c->screen, r->tag);
|
||||
|
||||
c->theme = r->theme;
|
||||
|
||||
/* free = false for originally free client */
|
||||
if(r->flags & RULE_FREE)
|
||||
c->flags |= CLIENT_FREE;
|
||||
else
|
||||
c->flags &= ~CLIENT_FREE;
|
||||
|
||||
/* Free rule is not compatible with tab rule */
|
||||
if(r->flags & RULE_TAB)
|
||||
W->flags ^= WMFS_TABNOC; /* < can be disable by client_tab_next_opened */
|
||||
|
||||
if(r->flags & RULE_IGNORE_TAG)
|
||||
c->flags |= CLIENT_IGNORE_TAG;
|
||||
|
||||
c->flags |= CLIENT_RULED;
|
||||
}
|
||||
_apply_rule(c, r);
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
@ -928,6 +936,10 @@ client_apply_rule(struct client *c)
|
||||
|
||||
if(wmname)
|
||||
free(wmname);
|
||||
|
||||
/* Apply default rule */
|
||||
if (!(c->flags & CLIENT_RULED) && defaultr != NULL)
|
||||
_apply_rule(c, defaultr);
|
||||
}
|
||||
|
||||
struct client*
|
||||
|
||||
10
src/config.c
10
src/config.c
@ -235,9 +235,19 @@ config_client(void)
|
||||
sec = fetch_section_first(NULL, "client");
|
||||
|
||||
W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);
|
||||
|
||||
/* Get theme */
|
||||
tmp = fetch_opt_first(sec, "default", "theme").str;
|
||||
W->ctheme = name_to_theme(tmp);
|
||||
|
||||
/* Get focus configuration */
|
||||
W->cfocus = 0;
|
||||
tmp = fetch_opt_first(sec, "enter", "focus").str;
|
||||
if(strstr(tmp, "enter"))
|
||||
W->cfocus |= CFOCUS_ENTER;
|
||||
if(strstr(tmp, "click"))
|
||||
W->cfocus |= CFOCUS_CLICK;
|
||||
|
||||
/* [mouse] */
|
||||
/* for client frame AND titlebar */
|
||||
if((mb = fetch_section(sec, "mouse")))
|
||||
|
||||
@ -27,6 +27,7 @@ event_buttonpress(XEvent *e)
|
||||
XButtonEvent *ev = &e->xbutton;
|
||||
struct mousebind *m;
|
||||
struct barwin *b;
|
||||
struct client *c;
|
||||
|
||||
screen_update_sel();
|
||||
status_flush_surface();
|
||||
@ -44,6 +45,9 @@ event_buttonpress(XEvent *e)
|
||||
|
||||
break;
|
||||
}
|
||||
if((c = client_gb_win(ev->window)) && c != W->client
|
||||
&& ev->button == 1 && W->cfocus & CFOCUS_CLICK)
|
||||
client_focus(c);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -67,7 +71,8 @@ event_enternotify(XEvent *e)
|
||||
c->flags ^= CLIENT_IGNORE_ENTER;
|
||||
else if(c->tag->flags & TAG_IGNORE_ENTER)
|
||||
c->tag->flags ^= TAG_IGNORE_ENTER;
|
||||
else if(c != W->client && !(c->flags & CLIENT_TABBED))
|
||||
else if(c != W->client && !(c->flags & CLIENT_TABBED)
|
||||
&& W->cfocus & CFOCUS_ENTER)
|
||||
client_focus(c);
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,6 +350,9 @@ struct wmfs
|
||||
char *confpath;
|
||||
struct barwin *last_clicked_barwin;
|
||||
struct theme *ctheme;
|
||||
#define CFOCUS_ENTER 0x01
|
||||
#define CFOCUS_CLICK 0x02
|
||||
Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER or CFOCUS_CLICK*/
|
||||
|
||||
/* Log file */
|
||||
FILE *log;
|
||||
|
||||
9
wmfs.1
9
wmfs.1
@ -63,6 +63,11 @@ Exit WMFS
|
||||
Toggle free the selected client
|
||||
.RE
|
||||
.PP
|
||||
\fBSuper + Shift + f \fR
|
||||
.RS 4
|
||||
Toggle ignore_tag the selected client
|
||||
.RE
|
||||
.PP
|
||||
\fBAlt + Tab\fR
|
||||
.RS 4
|
||||
Give the focus to the next client
|
||||
@ -624,8 +629,10 @@ move focus to previous tab-client\&.
|
||||
give focus to client with a clic\&.
|
||||
.PP
|
||||
\fB\ client_toggle_free\fR
|
||||
togle free the client\&.
|
||||
toggle free the selected client\&.
|
||||
.PP
|
||||
\fB\ client_toggle_ignore_tag\fR
|
||||
toggle ignore_tag the selected client\&.
|
||||
\fB\ client_tab_next_opened\fR
|
||||
open the client in a tab\&.
|
||||
.PP
|
||||
|
||||
10
wmfsrc
10
wmfsrc
@ -118,6 +118,12 @@
|
||||
theme = "default"
|
||||
key_modifier = "Super"
|
||||
|
||||
# Focus type:
|
||||
# enter : focus follow mouse (default)
|
||||
# click : click to focus
|
||||
# everything-else : disable mouse focus support
|
||||
focus = enter
|
||||
|
||||
[mouse] button = "1" func = "client_focus_click" [/mouse]
|
||||
[mouse] button = "1" func = "mouse_swap" [/mouse]
|
||||
[mouse] button = "2" func = "mouse_tab" [/mouse]
|
||||
@ -130,6 +136,7 @@
|
||||
[rules]
|
||||
|
||||
[rule]
|
||||
# use instance = "*" for a all-clients rule
|
||||
instance = "chromium"
|
||||
|
||||
# role = ""
|
||||
@ -256,6 +263,9 @@
|
||||
# Toggle client free/tile
|
||||
[key] mod = {"Super"} key = "f" func = "client_toggle_free" [/key]
|
||||
|
||||
# Toggle client ignore_tag
|
||||
[key] mod = {"Super", "Shift"} key = "f" func = "client_toggle_ignore_tag" [/key]
|
||||
|
||||
# Launcher
|
||||
[key] mod = {"Super"} key = "p" func = "launcher" cmd = "exec" [/key]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user