From ceb6cc797a184f5a839d69317ada9e8bbb47f5bb Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 11 Nov 2007 11:55:20 +0100 Subject: [PATCH] ncol is now configurable per tag --- awesomerc | 2 +- config.c | 5 ++--- config.h | 4 ++-- layouts/tile.c | 9 +++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/awesomerc b/awesomerc index 483aef6c5..c5441594f 100644 --- a/awesomerc +++ b/awesomerc @@ -39,6 +39,7 @@ screen 0 } tag 3 { + ncol = 2 layout = "tile" } tag 4 @@ -71,7 +72,6 @@ screen 0 layouts { - ncol = 1 layout tile { symbol = "[]=" diff --git a/config.c b/config.c index 0a5d66a54..531d5acd8 100644 --- a/config.c +++ b/config.c @@ -177,6 +177,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf) CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE), CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE), CFG_INT((char *) "nmaster", 1, CFGF_NONE), + CFG_INT((char *) "ncol", 1, CFGF_NONE), CFG_END() }; static cfg_opt_t tags_opts[] = @@ -192,7 +193,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_INT((char *) "ncol", 1, CFGF_NONE), CFG_END() }; 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->ncol = cfg_getint(cfg_layouts, "ncol"); - if(!awesomeconf->nlayouts) 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].mwfact = cfg_getfloat(cfgsectmp, "mwfact"); awesomeconf->tags[i].nmaster = cfg_getint(cfgsectmp, "nmaster"); + awesomeconf->tags[i].ncol = cfg_getint(cfgsectmp, "ncol"); } diff --git a/config.h b/config.h index 6311fedf9..9ceac7208 100644 --- a/config.h +++ b/config.h @@ -136,6 +136,8 @@ typedef struct double mwfact; /** Number of master windows */ int nmaster; + /** Number of columns in tile layout */ + int ncol; } Tag; /** Main configuration structure */ @@ -171,8 +173,6 @@ struct awesome_config int borderpx; /** Number of pixels to snap windows */ int snap; - /** Number of columns in tile layout */ - int ncol; /** Transparency of unfocused clients */ int opacity_unfocused; /** Focus move pointer */ diff --git a/layouts/tile.c b/layouts/tile.c index 4698ce8c8..d592d0efe 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -48,13 +48,14 @@ void uicb_setncol(awesome_config *awesomeconf, 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)) return; - if((awesomeconf->ncol = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncol)) < 1) - awesomeconf->ncol = 1; + if((curtag->ncol = (int) compute_new_value_from_arg(arg, (double) curtag->ncol)) < 1) + curtag->ncol = 1; arrange(awesomeconf); } @@ -129,7 +130,7 @@ _tile(awesome_config *awesomeconf, const Bool right) else 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) {