introduce fuzzy logic: fix problem with not_master
This commit is contained in:
parent
0e890697ac
commit
befcf19ea2
|
@ -519,10 +519,10 @@ rules
|
|||
xproperty_name = <string>
|
||||
xproperty_value = <regex>
|
||||
float = <{auto,true,false}>
|
||||
master = <{auto,true,false}>
|
||||
tags = <regex>
|
||||
screen = <integer>
|
||||
icon = <image>
|
||||
not_master = <boolean>
|
||||
opacity = <float>
|
||||
}
|
||||
}
|
||||
|
|
31
client.c
31
client.c
|
@ -351,10 +351,10 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
{
|
||||
case Auto:
|
||||
break;
|
||||
case Float:
|
||||
case Yes:
|
||||
client_setfloating(c, True);
|
||||
break;
|
||||
case Tile:
|
||||
case No:
|
||||
client_setfloating(c, False);
|
||||
break;
|
||||
}
|
||||
|
@ -391,12 +391,27 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
}
|
||||
|
||||
/* attach to the stack */
|
||||
if((rule = rule_matching_client(c)) && rule->not_master)
|
||||
client_list_append(&globalconf.clients, c);
|
||||
else if(globalconf.screens[c->screen].new_become_master)
|
||||
client_list_push(&globalconf.clients, c);
|
||||
else
|
||||
client_list_append(&globalconf.clients, c);
|
||||
if((rule = rule_matching_client(c)))
|
||||
switch(rule->ismaster)
|
||||
{
|
||||
case Yes:
|
||||
client_list_push(&globalconf.clients, c);
|
||||
break;
|
||||
case No:
|
||||
client_list_append(&globalconf.clients, c);
|
||||
break;
|
||||
case Auto:
|
||||
rule = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!rule)
|
||||
{
|
||||
if(globalconf.screens[c->screen].new_become_master)
|
||||
client_list_push(&globalconf.clients, c);
|
||||
else
|
||||
client_list_append(&globalconf.clients, c);
|
||||
}
|
||||
|
||||
/* some windows require this */
|
||||
XMoveResizeWindow(globalconf.display, c->win, c->geometry.x, c->geometry.y,
|
||||
|
|
|
@ -238,8 +238,8 @@ cfg_opt_t rule_opts[] =
|
|||
CFG_STR((char *) "tags", NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "icon", NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
|
||||
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
|
||||
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
|
||||
CFG_BOOL((char *) "not_master", cfg_false, CFGF_NONE),
|
||||
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
|
4
config.c
4
config.c
|
@ -494,9 +494,9 @@ config_parse(const char *confpatharg)
|
|||
rule->xprop = a_strdup(cfg_getstr(cfgsectmp, "xproperty_name"));
|
||||
rule->xpropval_r = rules_compile_regex(cfg_getstr(cfgsectmp, "xproperty_value"));
|
||||
rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon"));
|
||||
rule->isfloating = rules_get_float_from_str(cfg_getstr(cfgsectmp, "float"));
|
||||
rule->isfloating = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "float"));
|
||||
rule->screen = cfg_getint(cfgsectmp, "screen");
|
||||
rule->not_master = cfg_getbool(cfgsectmp, "not_master");
|
||||
rule->ismaster = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "master"));
|
||||
rule->opacity = cfg_getfloat(cfgsectmp, "opacity");
|
||||
if(rule->screen >= globalconf.nscreen)
|
||||
rule->screen = 0;
|
||||
|
|
8
rules.c
8
rules.c
|
@ -107,13 +107,13 @@ rule_matching_client(Client *c)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
RuleFloat
|
||||
rules_get_float_from_str(const char *str)
|
||||
Fuzzy
|
||||
rules_get_fuzzy_from_str(const char *str)
|
||||
{
|
||||
if(!a_strcmp(str, "true") || !a_strcmp(str, "yes"))
|
||||
return Float;
|
||||
return Yes;
|
||||
else if(!a_strcmp(str, "false") || !a_strcmp(str, "no"))
|
||||
return Tile;
|
||||
return No;
|
||||
|
||||
return Auto;
|
||||
}
|
||||
|
|
2
rules.h
2
rules.h
|
@ -28,7 +28,7 @@
|
|||
|
||||
regex_t * rules_compile_regex(char *);
|
||||
Bool tag_match_rule(Tag *, Rule *);
|
||||
RuleFloat rules_get_float_from_str(const char *);
|
||||
Fuzzy rules_get_fuzzy_from_str(const char *);
|
||||
Rule * rule_matching_client(Client *);
|
||||
|
||||
DO_SLIST(Rule, rule, p_delete);
|
||||
|
|
12
structs.h
12
structs.h
|
@ -40,10 +40,10 @@ typedef enum
|
|||
/** Rules for floating rule */
|
||||
typedef enum
|
||||
{
|
||||
Float,
|
||||
Tile,
|
||||
Auto,
|
||||
} RuleFloat;
|
||||
Yes,
|
||||
No,
|
||||
Auto
|
||||
} Fuzzy;
|
||||
|
||||
/** Common colors */
|
||||
enum
|
||||
|
@ -60,8 +60,8 @@ struct Rule
|
|||
char *icon;
|
||||
char *xprop;
|
||||
int screen;
|
||||
RuleFloat isfloating;
|
||||
Bool not_master;
|
||||
Fuzzy isfloating;
|
||||
Fuzzy ismaster;
|
||||
double opacity;
|
||||
regex_t *prop_r;
|
||||
regex_t *tags_r;
|
||||
|
|
Loading…
Reference in New Issue