fix client ignore_tag rule not beeing applied

This commit is contained in:
Jérémy Anger 2012-04-15 22:55:02 +02:00
commit 8d2f2937a4
6 changed files with 74 additions and 27 deletions

View File

@ -847,6 +847,34 @@ client_frame_new(struct client *c)
XReparentWindow(W->dpy, c->win, c->frame, c->border, c->tbarw); 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 RINSTANCE 0x01
#define RCLASS 0x02 #define RCLASS 0x02
#define RROLE 0x04 #define RROLE 0x04
@ -855,6 +883,7 @@ static void
client_apply_rule(struct client *c) client_apply_rule(struct client *c)
{ {
struct rule *r; struct rule *r;
struct rule *defaultr = NULL;
char *wmname = NULL; char *wmname = NULL;
char *role = NULL; char *role = NULL;
int f; int f;
@ -883,8 +912,11 @@ client_apply_rule(struct client *c)
XFree(data); XFree(data);
} }
/* Apply a specific rule */
SLIST_FOREACH(r, &W->h.rule, next) SLIST_FOREACH(r, &W->h.rule, next)
{ {
if (r->instance && !strcmp(r->instance, "*"))
defaultr = r;
if(s) if(s)
{ {
FLAGAPPLY(flags, (xch.res_name && r->instance && !strcmp(xch.res_name, r->instance)), RINSTANCE); 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); FLAGAPPLY(flags, ((role && r->role && !strcmp(role, r->role)) || !role || !r->role), RROLE);
if(flags & (RINSTANCE | RCLASS | RNAME) && flags & RROLE) if(flags & (RINSTANCE | RCLASS | RNAME) && flags & RROLE)
{ _apply_rule(c, 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;
}
flags = 0; flags = 0;
} }
@ -928,6 +936,10 @@ client_apply_rule(struct client *c)
if(wmname) if(wmname)
free(wmname); free(wmname);
/* Apply default rule */
if (!(c->flags & CLIENT_RULED) && defaultr != NULL)
_apply_rule(c, defaultr);
} }
struct client* struct client*

View File

@ -235,9 +235,19 @@ config_client(void)
sec = fetch_section_first(NULL, "client"); sec = fetch_section_first(NULL, "client");
W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str); W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);
/* Get theme */
tmp = fetch_opt_first(sec, "default", "theme").str; tmp = fetch_opt_first(sec, "default", "theme").str;
W->ctheme = name_to_theme(tmp); 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] */ /* [mouse] */
/* for client frame AND titlebar */ /* for client frame AND titlebar */
if((mb = fetch_section(sec, "mouse"))) if((mb = fetch_section(sec, "mouse")))

View File

@ -27,6 +27,7 @@ event_buttonpress(XEvent *e)
XButtonEvent *ev = &e->xbutton; XButtonEvent *ev = &e->xbutton;
struct mousebind *m; struct mousebind *m;
struct barwin *b; struct barwin *b;
struct client *c;
screen_update_sel(); screen_update_sel();
status_flush_surface(); status_flush_surface();
@ -44,6 +45,9 @@ event_buttonpress(XEvent *e)
break; break;
} }
if((c = client_gb_win(ev->window)) && c != W->client
&& ev->button == 1 && W->cfocus & CFOCUS_CLICK)
client_focus(c);
} }
static void static void
@ -67,7 +71,8 @@ event_enternotify(XEvent *e)
c->flags ^= CLIENT_IGNORE_ENTER; c->flags ^= CLIENT_IGNORE_ENTER;
else if(c->tag->flags & TAG_IGNORE_ENTER) else if(c->tag->flags & TAG_IGNORE_ENTER)
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); client_focus(c);
} }
} }

View File

@ -350,6 +350,9 @@ struct wmfs
char *confpath; char *confpath;
struct barwin *last_clicked_barwin; struct barwin *last_clicked_barwin;
struct theme *ctheme; 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 */ /* Log file */
FILE *log; FILE *log;

9
wmfs.1
View File

@ -63,6 +63,11 @@ Exit WMFS
Toggle free the selected client Toggle free the selected client
.RE .RE
.PP .PP
\fBSuper + Shift + f \fR
.RS 4
Toggle ignore_tag the selected client
.RE
.PP
\fBAlt + Tab\fR \fBAlt + Tab\fR
.RS 4 .RS 4
Give the focus to the next client Give the focus to the next client
@ -624,8 +629,10 @@ move focus to previous tab-client\&.
give focus to client with a clic\&. give focus to client with a clic\&.
.PP .PP
\fB\ client_toggle_free\fR \fB\ client_toggle_free\fR
togle free the client\&. toggle free the selected client\&.
.PP .PP
\fB\ client_toggle_ignore_tag\fR
toggle ignore_tag the selected client\&.
\fB\ client_tab_next_opened\fR \fB\ client_tab_next_opened\fR
open the client in a tab\&. open the client in a tab\&.
.PP .PP

10
wmfsrc
View File

@ -118,6 +118,12 @@
theme = "default" theme = "default"
key_modifier = "Super" 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 = "client_focus_click" [/mouse]
[mouse] button = "1" func = "mouse_swap" [/mouse] [mouse] button = "1" func = "mouse_swap" [/mouse]
[mouse] button = "2" func = "mouse_tab" [/mouse] [mouse] button = "2" func = "mouse_tab" [/mouse]
@ -130,6 +136,7 @@
[rules] [rules]
[rule] [rule]
# use instance = "*" for a all-clients rule
instance = "chromium" instance = "chromium"
# role = "" # role = ""
@ -256,6 +263,9 @@
# Toggle client free/tile # Toggle client free/tile
[key] mod = {"Super"} key = "f" func = "client_toggle_free" [/key] [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 # Launcher
[key] mod = {"Super"} key = "p" func = "launcher" cmd = "exec" [/key] [key] mod = {"Super"} key = "p" func = "launcher" cmd = "exec" [/key]