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.
This commit is contained in:
daniel@brinkers.de 2007-10-10 18:47:58 +02:00 committed by Julien Danjou
parent a04ce1f4ef
commit 9d95d4691c
2 changed files with 17 additions and 4 deletions

View File

@ -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;

View File

@ -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);
}