implement not_master rules option (FS#6)

This commit is contained in:
Julien Danjou 2008-01-02 12:00:36 +01:00
parent 9e93857864
commit 0cf4ff6d9f
4 changed files with 29 additions and 1 deletions

View File

@ -281,6 +281,7 @@ rules
name=<regex> name=<regex>
screen=<integer> screen=<integer>
tags=<integer-list,...> tags=<integer-list,...>
not_master=<{true,false}>
} }
} }
keys keys

View File

@ -187,6 +187,22 @@ client_ban(Client * c)
window_setstate(c->win, IconicState); window_setstate(c->win, IconicState);
} }
static void
client_attach_at_end(Client *c)
{
Client *iter;
for(iter = globalconf.clients; iter && iter->next; iter = iter->next);
/* stack is empty */
if(!iter)
globalconf.clients = c;
else
{
c->prev = iter;
iter->next = c;
}
}
/** Attach client to the beginning of the clients stack /** Attach client to the beginning of the clients stack
* \param c the client * \param c the client
*/ */
@ -289,6 +305,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
XWindowChanges wc; XWindowChanges wc;
Area area, darea; Area area, darea;
Tag *tag; Tag *tag;
Rule *rule;
c = p_new(Client, 1); c = p_new(Client, 1);
@ -381,6 +398,13 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
client_saveprops(c); client_saveprops(c);
/* attach to the stack */ /* attach to the stack */
for(rule = globalconf.rules; rule; rule = rule->next)
if(rule->not_master && client_match_rule(c, rule))
{
client_attach_at_end(c);
break;
}
if(!rule)
client_attach(c); client_attach(c);
/* some windows require this */ /* some windows require this */

View File

@ -612,6 +612,7 @@ config_parse(const char *confpatharg)
CFG_STR((char *) "icon", (char *) "", CFGF_NONE), CFG_STR((char *) "icon", (char *) "", CFGF_NONE),
CFG_BOOL((char *) "float", cfg_false, CFGF_NONE), CFG_BOOL((char *) "float", cfg_false, CFGF_NONE),
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE), CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
CFG_BOOL((char *) "not_master", cfg_false, CFGF_NONE),
CFG_END() CFG_END()
}; };
static cfg_opt_t rules_opts[] = static cfg_opt_t rules_opts[] =
@ -712,6 +713,7 @@ config_parse(const char *confpatharg)
rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon")); rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon"));
rule->isfloating = cfg_getbool(cfgsectmp, "float"); rule->isfloating = cfg_getbool(cfgsectmp, "float");
rule->screen = cfg_getint(cfgsectmp, "screen"); rule->screen = cfg_getint(cfgsectmp, "screen");
rule->not_master = cfg_getbool(cfgsectmp, "not_master");
if(rule->screen >= get_screen_count()) if(rule->screen >= get_screen_count())
rule->screen = 0; rule->screen = 0;

View File

@ -45,6 +45,7 @@ struct Rule
char *icon; char *icon;
int screen; int screen;
Bool isfloating; Bool isfloating;
Bool not_master;
regex_t *propregex; regex_t *propregex;
regex_t *tagregex; regex_t *tagregex;
Rule *next; Rule *next;