From 32b098796e02062abbf87d360ac9615310ceaacd Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 11 Nov 2007 11:48:26 +0100 Subject: [PATCH] mwfact is now configurable per tag --- awesomerc | 2 +- config.c | 4 ++-- config.h | 4 ++-- layouts/tile.c | 14 ++++++++------ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/awesomerc b/awesomerc index 4668d4b9..06d2f517 100644 --- a/awesomerc +++ b/awesomerc @@ -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 diff --git a/config.c b/config.c index b4f633bb..2ed61e5b 100644 --- a/config.c +++ b/config.c @@ -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"); } diff --git a/config.h b/config.h index fc097c17..734a8cd0 100644 --- a/config.h +++ b/config.h @@ -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 */ diff --git a/layouts/tile.c b/layouts/tile.c index 24560777..3a646a5c 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -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;