From 0cf4ff6d9facc78fd284d43928ef9d00774ac7fe Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 2 Jan 2008 12:00:36 +0100 Subject: [PATCH] implement not_master rules option (FS#6) --- awesomerc.1.txt | 1 + client.c | 26 +++++++++++++++++++++++++- config.c | 2 ++ config.h | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/awesomerc.1.txt b/awesomerc.1.txt index ce1dee45b..1511420d2 100644 --- a/awesomerc.1.txt +++ b/awesomerc.1.txt @@ -281,6 +281,7 @@ rules name= screen= tags= + not_master=<{true,false}> } } keys diff --git a/client.c b/client.c index 65151b994..0a5a901cd 100644 --- a/client.c +++ b/client.c @@ -187,6 +187,22 @@ client_ban(Client * c) 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 * \param c the client */ @@ -289,6 +305,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen) XWindowChanges wc; Area area, darea; Tag *tag; + Rule *rule; c = p_new(Client, 1); @@ -381,7 +398,14 @@ client_manage(Window w, XWindowAttributes *wa, int screen) client_saveprops(c); /* attach to the stack */ - client_attach(c); + 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); /* some windows require this */ XMoveResizeWindow(globalconf.display, c->win, c->x, c->y, c->w, c->h); diff --git a/config.c b/config.c index 4b2748283..2374bbc21 100644 --- a/config.c +++ b/config.c @@ -612,6 +612,7 @@ config_parse(const char *confpatharg) CFG_STR((char *) "icon", (char *) "", CFGF_NONE), CFG_BOOL((char *) "float", cfg_false, CFGF_NONE), CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE), + CFG_BOOL((char *) "not_master", cfg_false, CFGF_NONE), CFG_END() }; static cfg_opt_t rules_opts[] = @@ -712,6 +713,7 @@ config_parse(const char *confpatharg) rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon")); rule->isfloating = cfg_getbool(cfgsectmp, "float"); rule->screen = cfg_getint(cfgsectmp, "screen"); + rule->not_master = cfg_getbool(cfgsectmp, "not_master"); if(rule->screen >= get_screen_count()) rule->screen = 0; diff --git a/config.h b/config.h index 20aee6afd..d321f61f4 100644 --- a/config.h +++ b/config.h @@ -45,6 +45,7 @@ struct Rule char *icon; int screen; Bool isfloating; + Bool not_master; regex_t *propregex; regex_t *tagregex; Rule *next;