From 9d95d4691c389f418f097f9c8d93c0ab58a3e532 Mon Sep 17 00:00:00 2001 From: "daniel@brinkers.de" Date: Wed, 10 Oct 2007 18:47:58 +0200 Subject: [PATCH] tags default layout this patch should consider the tags default layout, given in the config file. It also set the layout to default, when awesome is restarted. --- config.c | 13 ++++++++++--- layout.c | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/config.c b/config.c index 13036f0f..9532a3d3 100644 --- a/config.c +++ b/config.c @@ -255,6 +255,7 @@ parse_config(Display * disp, int scr,const char *confpatharg, awesome_config *aw *cfg_tags, *cfg_layouts, *cfg_rules, *cfg_keys, *cfgsectmp; int i = 0; unsigned int j = 0; + int k = 0; const char *tmp, *homedir; char *confpath; KeySym tmp_key; @@ -349,8 +350,6 @@ parse_config(Display * disp, int scr,const char *confpatharg, awesome_config *aw awesomeconf->nmaster = cfg_getint(cfg_layouts, "nmaster"); awesomeconf->ncol = cfg_getint(cfg_layouts, "ncol"); - awesomeconf->current_layout = awesomeconf->layouts; - if(!awesomeconf->nlayouts || !awesomeconf->current_layout->arrange) eprint("awesome: fatal: no default layout available\n"); @@ -378,13 +377,21 @@ parse_config(Display * disp, int scr,const char *confpatharg, awesome_config *aw awesomeconf->tags[i].name = a_strdup(cfg_title(cfgsectmp)); awesomeconf->tags[i].selected = False; awesomeconf->tags[i].was_selected = False; - awesomeconf->tags[i].layout = awesomeconf->layouts; + tmp = cfg_getstr(cfgsectmp, "layout"); + for(k = 0; k < awesomeconf->nlayouts; k++) + if(awesomeconf->layouts[k].arrange == name_func_lookup(tmp, LayoutsList)) + break; + if(k == awesomeconf->nlayouts) + k = 0; + awesomeconf->tags[i].layout = &awesomeconf->layouts[k]; } + if(!awesomeconf->ntags) eprint("awesome: fatal: no tags found in configuration file\n"); /* select first tag by default */ + awesomeconf->current_layout = awesomeconf->tags[0].layout; awesomeconf->tags[0].selected = True; awesomeconf->tags[0].was_selected = True; diff --git a/layout.c b/layout.c index f22661bd..4c4576c4 100644 --- a/layout.c +++ b/layout.c @@ -105,7 +105,13 @@ loadawesomeprops(Display *disp, awesome_config * awesomeconf) if(xgettextprop(disp, RootWindow(disp, awesomeconf->phys_screen), AWESOMEPROPS_ATOM(disp), prop, awesomeconf->ntags + 1)) for(i = 0; i < awesomeconf->ntags && prop[i]; i++) - awesomeconf->tags[i].selected = prop[i] == '1'; + if(prop[i] == '1') + { + awesomeconf->tags[i].selected = True; + awesomeconf->current_layout = awesomeconf->tags[i].layout; + } + else + awesomeconf->tags[i].selected = False; p_delete(&prop); }