diff --git a/awesomerc b/awesomerc index b42f7f48d..4c453c9c3 100644 --- a/awesomerc +++ b/awesomerc @@ -21,6 +21,7 @@ awesome: focus_border_color = "#008b8b"; focus_bg_color = "#008b8b"; focus_fg_color = "#ffffff"; + opacity_unfocused = 100; # Available layouts layouts = (("[]=", "tile"), @@ -32,6 +33,7 @@ awesome: # Number of master windows (used by tile layouts) nmaster = 2; + ncols = 1; # Resize hints resize_hints = true; @@ -70,9 +72,11 @@ awesome: (("Mod4"), "k", "focusprev"), (("Mod4"), "h", "setmwfact", "-0.05"), (("Mod4"), "l", "setmwfact", "+0.05"), + (("Mod4", "Shift"), "h", "setnmaster", "+1"), + (("Mod4", "Shift"), "l", "setnmaster", "-1"), + (("Mod4", "Control"), "h", "setncols", "+1"), + (("Mod4", "Control"), "l", "setncols", "-1"), (("Mod4"), "Escape", "viewprevtags"), - (("Mod4", "Shift"), "h", "incnmaster", "+1"), - (("Mod4", "Shift"), "l", "incnmaster", "-1"), (("Mod4"), "m", "togglemax"), (("Mod4"), "t", "settrans", "-5"), (("Mod4", "Shift"), "t", "settrans", "+5"), diff --git a/config.c b/config.c index b28254c0e..55aa83103 100644 --- a/config.c +++ b/config.c @@ -108,6 +108,7 @@ static const NameFuncLink KeyfuncList[] = { /* layouts/tile.c */ {"setmwfact", uicb_setmwfact}, {"setnmaster", uicb_setnmaster}, + {"setncols", uicb_setncols}, /* awesome.c */ {"quit", uicb_quit}, {NULL, NULL} @@ -335,6 +336,10 @@ parse_config(Display * disp, int scr, DC * drawcontext, awesome_config *awesomec i = config_lookup_int(&awesomelibconf, "awesome.nmaster"); awesomeconf->nmaster = i ? i : 1; + /* ncols */ + i = config_lookup_int(&awesomelibconf, "awesome.ncols"); + awesomeconf->ncols = i ? i : 1; + /* mwfact */ f = config_lookup_float(&awesomelibconf, "awesome.mwfact"); awesomeconf->mwfact = f ? f : 0.6; diff --git a/config.h b/config.h index 617605eb0..865b433d4 100644 --- a/config.h +++ b/config.h @@ -129,6 +129,8 @@ struct awesome_config int snap; /** Number of master windows */ int nmaster; + /** Number of columns in tile layout */ + int ncols; /** Transparency of unfocused clients */ int opacity_unfocused; /** Respect resize hints */ diff --git a/layouts/tile.c b/layouts/tile.c index e47340273..dfddb3037 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -32,9 +32,20 @@ extern Client *sel, *clients; /* static */ -static double mwfact = 0.6; -static int nmaster = 2; -static int ncols = 2; +static double mwfact = -1; +static int nmaster = -1; +static int ncols = -1; + +static void +init_static_var_layout(awesome_config *awesomeconf) +{ + if(mwfact == -1) + mwfact = awesomeconf->mwfact; + if(nmaster == -1) + nmaster = awesomeconf->nmaster; + if(ncols == -1) + ncols = awesomeconf->ncols; +} void uicb_setnmaster(Display *disp, @@ -47,8 +58,7 @@ uicb_setnmaster(Display *disp, if(!arg) nmaster = awesomeconf->nmaster; - else - if((nmaster = (int) compute_new_value_from_arg(arg, (double) nmaster)) < 0) + else if((nmaster = (int) compute_new_value_from_arg(arg, (double) nmaster)) < 0) nmaster = 0; if(sel) @@ -57,6 +67,26 @@ uicb_setnmaster(Display *disp, drawstatus(disp, drawcontext, awesomeconf); } +void +uicb_setncols(Display *disp, + DC * drawcontext, + awesome_config *awesomeconf, + const char * arg) +{ + if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft)) + return; + + if(!arg) + ncols = awesomeconf->ncols; + else if((ncols = (int) compute_new_value_from_arg(arg, (double) ncols)) < 1) + ncols = 1; + + if(sel) + arrange(disp, drawcontext, awesomeconf); + else + drawstatus(disp, drawcontext, awesomeconf); +} + void uicb_setmwfact(Display *disp, DC *drawcontext, @@ -93,6 +123,7 @@ _tile(Display *disp, awesome_config *awesomeconf, const Bool right) ScreenInfo *screens_info = NULL; Client *c; + init_static_var_layout(awesomeconf); screens_info = get_screen_info(disp, awesomeconf->statusbar, &screen_numbers); for(n = 0, c = clients; c; c = c->next) diff --git a/layouts/tile.h b/layouts/tile.h index b9af4a297..138544bf4 100644 --- a/layouts/tile.h +++ b/layouts/tile.h @@ -26,6 +26,7 @@ #include void uicb_setnmaster(Display *, DC *, awesome_config *, const char *); /* change number of master windows */ +void uicb_setncols(Display *, DC *, awesome_config *, const char *); void uicb_setmwfact(Display *, DC *, awesome_config *, const char *); /* sets master width factor */ void tile(Display *, awesome_config *); void tileleft(Display *, awesome_config *);