Apply pierreN patch: _NET_WM_NAME attribute in rules
This commit is contained in:
parent
9c3130a17c
commit
69ec9d7db0
16
src/client.c
16
src/client.c
@ -590,6 +590,7 @@ client_set_rules(Client *c)
|
||||
ulong n, il;
|
||||
uchar *data = NULL;
|
||||
char wwrole[256] = { 0 };
|
||||
char netwmname[256] = { 0 };
|
||||
bool applied_tag_rule = False;
|
||||
bool applied_screen_rule = False;
|
||||
|
||||
@ -612,14 +613,25 @@ client_set_rules(Client *c)
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
/* Apply Rule if class || instance || role match */
|
||||
/* Get _NET_WM_NAME */
|
||||
if(XGetWindowProperty(dpy, c->win, ATOM("_NET_WM_NAME"), 0, 0x77777777, False,
|
||||
ATOM("UTF8_STRING"), &rf, &f, &n, &il, &data) == Success && data)
|
||||
{
|
||||
strncpy(netwmname, (char*)data, sizeof(netwmname));
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
/* Apply Rule if class || instance || role || name match */
|
||||
for(i = 0; i < conf.nrule; ++i)
|
||||
{
|
||||
if((xch.res_class && conf.rule[i].class && !strcmp(xch.res_class, conf.rule[i].class))
|
||||
|| (xch.res_name && conf.rule[i].instance && !strcmp(xch.res_name, conf.rule[i].instance)))
|
||||
{
|
||||
if((strlen(wwrole) && conf.rule[i].role && !strcmp(wwrole, conf.rule[i].role))
|
||||
if( ((strlen(wwrole) && conf.rule[i].role && !strcmp(wwrole, conf.rule[i].role))
|
||||
|| (!strlen(wwrole) || !conf.rule[i].role))
|
||||
&&
|
||||
((strlen(netwmname) && conf.rule[i].name && !strcmp(netwmname, conf.rule[i].name))
|
||||
|| (!strlen(netwmname) || !conf.rule[i].name)) )
|
||||
{
|
||||
if(conf.rule[i].screen != -1)
|
||||
c->screen = conf.rule[i].screen;
|
||||
|
||||
@ -678,6 +678,7 @@ conf_rule_section(void)
|
||||
conf.rule[i].class = fetch_opt_first(rule[i], "", "class").str;
|
||||
conf.rule[i].instance = fetch_opt_first(rule[i], "", "instance").str;
|
||||
conf.rule[i].role = fetch_opt_first(rule[i], "", "role").str;
|
||||
conf.rule[i].name = fetch_opt_first(rule[i], "", "name").str;
|
||||
conf.rule[i].screen = fetch_opt_first(rule[i], "-1", "screen").num;
|
||||
conf.rule[i].tag = fetch_opt_first(rule[i], "-1", "tag").num;
|
||||
conf.rule[i].free = fetch_opt_first(rule[i], "false", "free").boolean;
|
||||
|
||||
@ -384,6 +384,7 @@ typedef struct
|
||||
char *class;
|
||||
char *instance;
|
||||
char *role;
|
||||
char *name;
|
||||
int screen;
|
||||
int tag;
|
||||
bool free;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user