mwfact is now configurable per tag

This commit is contained in:
Julien Danjou 2007-11-11 11:48:26 +01:00
parent a30227e27b
commit 32b098796e
4 changed files with 13 additions and 11 deletions

View File

@ -58,6 +58,7 @@ screen 0
}
tag 8
{
mwfact = 0.3
layout = "tile"
}
tag 9
@ -69,7 +70,6 @@ screen 0
layouts
{
mwfact = 0.5
nmaster = 1
ncol = 1
layout tile

View File

@ -175,6 +175,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
static cfg_opt_t tag_opts[] =
{
CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE),
CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE),
CFG_END()
};
static cfg_opt_t tags_opts[] =
@ -190,7 +191,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
static cfg_opt_t layouts_opts[] =
{
CFG_SEC((char *) "layout", layout_opts, CFGF_TITLE | CFGF_MULTI),
CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE),
CFG_INT((char *) "nmaster", 1, CFGF_NONE),
CFG_INT((char *) "ncol", 1, CFGF_NONE),
CFG_END()
@ -337,7 +337,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
awesomeconf->layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol"));
}
awesomeconf->mwfact = cfg_getfloat(cfg_layouts, "mwfact");
awesomeconf->nmaster = cfg_getint(cfg_layouts, "nmaster");
awesomeconf->ncol = cfg_getint(cfg_layouts, "ncol");
@ -377,6 +376,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
if(k == awesomeconf->nlayouts)
k = 0;
awesomeconf->tags[i].layout = &awesomeconf->layouts[k];
awesomeconf->tags[i].mwfact = cfg_getfloat(cfgsectmp, "mwfact");
}

View File

@ -132,6 +132,8 @@ typedef struct
Layout *layout;
/** Selected client on this tag */
Client *client_sel;
/** Master width factor */
double mwfact;
} Tag;
/** Main configuration structure */
@ -165,8 +167,6 @@ struct awesome_config
unsigned int numlockmask;
/** Border size */
int borderpx;
/** Master width factor */
double mwfact;
/** Number of pixels to snap windows */
int snap;
/** Number of master windows */

View File

@ -63,7 +63,8 @@ uicb_setmwfact(awesome_config * awesomeconf,
const char *arg)
{
char *newarg;
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))
return;
@ -77,10 +78,10 @@ uicb_setmwfact(awesome_config * awesomeconf,
newarg[0] = '+';
}
if((awesomeconf->mwfact = compute_new_value_from_arg(newarg, awesomeconf->mwfact)) < 0.1)
awesomeconf->mwfact = 0.1;
else if(awesomeconf->mwfact > 0.9)
awesomeconf->mwfact = 0.9;
if((curtag->mwfact = compute_new_value_from_arg(newarg, curtag->mwfact)) < 0.1)
curtag->mwfact = 0.1;
else if(curtag->mwfact > 0.9)
curtag->mwfact = 0.9;
arrange(awesomeconf);
p_delete(&newarg);
@ -99,6 +100,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
int real_ncol = 1, win_by_col = 1, current_col = 0;
ScreenInfo *screens_info = NULL;
Client *c;
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
screens_info = get_screen_info(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar);
@ -121,7 +123,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
if(awesomeconf->nmaster)
{
mh = masterwin ? wah / masterwin : waw;
mw = otherwin ? waw * awesomeconf->mwfact : waw;
mw = otherwin ? waw * curtag->mwfact : waw;
}
else
mh = mw = 0;