ncol is now configurable per tag

This commit is contained in:
Julien Danjou 2007-11-11 11:55:20 +01:00
parent 59f377526f
commit ceb6cc797a
4 changed files with 10 additions and 10 deletions

View File

@ -39,6 +39,7 @@ screen 0
} }
tag 3 tag 3
{ {
ncol = 2
layout = "tile" layout = "tile"
} }
tag 4 tag 4
@ -71,7 +72,6 @@ screen 0
layouts layouts
{ {
ncol = 1
layout tile layout tile
{ {
symbol = "[]=" symbol = "[]="

View File

@ -177,6 +177,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE), CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE),
CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE), CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE),
CFG_INT((char *) "nmaster", 1, CFGF_NONE), CFG_INT((char *) "nmaster", 1, CFGF_NONE),
CFG_INT((char *) "ncol", 1, CFGF_NONE),
CFG_END() CFG_END()
}; };
static cfg_opt_t tags_opts[] = static cfg_opt_t tags_opts[] =
@ -192,7 +193,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
static cfg_opt_t layouts_opts[] = static cfg_opt_t layouts_opts[] =
{ {
CFG_SEC((char *) "layout", layout_opts, CFGF_TITLE | CFGF_MULTI), CFG_SEC((char *) "layout", layout_opts, CFGF_TITLE | CFGF_MULTI),
CFG_INT((char *) "ncol", 1, CFGF_NONE),
CFG_END() CFG_END()
}; };
static cfg_opt_t screen_opts[] = static cfg_opt_t screen_opts[] =
@ -337,8 +337,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
awesomeconf->layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol")); awesomeconf->layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol"));
} }
awesomeconf->ncol = cfg_getint(cfg_layouts, "ncol");
if(!awesomeconf->nlayouts) if(!awesomeconf->nlayouts)
eprint("awesome: fatal: no default layout available\n"); eprint("awesome: fatal: no default layout available\n");
@ -377,6 +375,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
awesomeconf->tags[i].layout = &awesomeconf->layouts[k]; awesomeconf->tags[i].layout = &awesomeconf->layouts[k];
awesomeconf->tags[i].mwfact = cfg_getfloat(cfgsectmp, "mwfact"); awesomeconf->tags[i].mwfact = cfg_getfloat(cfgsectmp, "mwfact");
awesomeconf->tags[i].nmaster = cfg_getint(cfgsectmp, "nmaster"); awesomeconf->tags[i].nmaster = cfg_getint(cfgsectmp, "nmaster");
awesomeconf->tags[i].ncol = cfg_getint(cfgsectmp, "ncol");
} }

View File

@ -136,6 +136,8 @@ typedef struct
double mwfact; double mwfact;
/** Number of master windows */ /** Number of master windows */
int nmaster; int nmaster;
/** Number of columns in tile layout */
int ncol;
} Tag; } Tag;
/** Main configuration structure */ /** Main configuration structure */
@ -171,8 +173,6 @@ struct awesome_config
int borderpx; int borderpx;
/** Number of pixels to snap windows */ /** Number of pixels to snap windows */
int snap; int snap;
/** Number of columns in tile layout */
int ncol;
/** Transparency of unfocused clients */ /** Transparency of unfocused clients */
int opacity_unfocused; int opacity_unfocused;
/** Focus move pointer */ /** Focus move pointer */

View File

@ -48,13 +48,14 @@ void
uicb_setncol(awesome_config *awesomeconf, uicb_setncol(awesome_config *awesomeconf,
const char * arg) const char * arg)
{ {
Layout *curlay = get_current_layout(awesomeconf->tags, awesomeconf->ntags); Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
Layout *curlay = curtag->layout;
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft)) if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
return; return;
if((awesomeconf->ncol = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncol)) < 1) if((curtag->ncol = (int) compute_new_value_from_arg(arg, (double) curtag->ncol)) < 1)
awesomeconf->ncol = 1; curtag->ncol = 1;
arrange(awesomeconf); arrange(awesomeconf);
} }
@ -129,7 +130,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
else else
mh = mw = 0; mh = mw = 0;
real_ncol = MIN(otherwin, awesomeconf->ncol); real_ncol = MIN(otherwin, curtag->ncol);
for(i = 0, c = *awesomeconf->clients; c; c = c->next) for(i = 0, c = *awesomeconf->clients; c; c = c->next)
{ {