diff --git a/awesomerc.5.txt b/awesomerc.5.txt index 855de3a5..5ee7f9e5 100644 --- a/awesomerc.5.txt +++ b/awesomerc.5.txt @@ -564,6 +564,8 @@ screen [MULTI] sloppy_focus_raise = snap = floating_placement = <{smart,under_mouse}> + mwfact_lower_limit = + mwfact_upper_limit = } tags { diff --git a/common/configopts.c b/common/configopts.c index f1abaddc..21ae66a7 100644 --- a/common/configopts.c +++ b/common/configopts.c @@ -80,6 +80,8 @@ cfg_opt_t general_opts[] = CFG_INT((char *) "text_shadow_offset", 1, CFGF_NONE), CFG_INT((char *) "opacity_unfocused", -1, CFGF_NONE), CFG_STR((char *) "floating_placement", (char *) "smart", CFGF_NONE), + CFG_FLOAT((char *) "mwfact_lower_limit", 0.1, CFGF_NONE), + CFG_FLOAT((char *) "mwfact_upper_limit", 0.9, CFGF_NONE), CFG_AWESOME_END() }; cfg_opt_t colors_opts[] = diff --git a/config.c b/config.c index 590a3595..3768887a 100644 --- a/config.c +++ b/config.c @@ -323,6 +323,30 @@ config_parse_screen(cfg_t *cfg, int screen) name_func_lookup(cfg_getstr(cfg_general, "floating_placement"), FloatingPlacementList); + virtscreen->mwfact_lower_limit = cfg_getfloat(cfg_general, "mwfact_lower_limit"); + virtscreen->mwfact_upper_limit = cfg_getfloat(cfg_general, "mwfact_upper_limit"); + + if(virtscreen->mwfact_lower_limit < 0 || virtscreen->mwfact_lower_limit > 1) + { + warn("incorrect value %f for mwfact_lower_limit, must be between 0 and 1\n", + virtscreen->mwfact_lower_limit); + virtscreen->mwfact_lower_limit = 0.1; + } + + if(virtscreen->mwfact_upper_limit < 0 || virtscreen->mwfact_upper_limit > 1) + { + warn("incorrect value %f for mwfact_upper_limit, must be between 0 and 1\n", + virtscreen->mwfact_lower_limit); + virtscreen->mwfact_upper_limit = 0.9; + } + + if(virtscreen->mwfact_upper_limit < virtscreen->mwfact_lower_limit) + { + warn("mwfact_upper_limit must be greater than mwfact_lower_limit\n"); + virtscreen->mwfact_upper_limit = 0.9; + virtscreen->mwfact_lower_limit = 0.1; + } + if(!virtscreen->floating_placement) { warn("unknown floating placement: %s\n", cfg_getstr(cfg_general, "floating_placement")); diff --git a/layouts/tile.c b/layouts/tile.c index 79be282e..bd8cc768 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -112,10 +112,12 @@ uicb_tag_setmwfact(int screen, char *arg) newarg[0] = '+'; } - if((curtags[0]->mwfact = compute_new_value_from_arg(newarg, curtags[0]->mwfact)) < 0.1) - curtags[0]->mwfact = 0.1; - else if(curtags[0]->mwfact > 0.9) - curtags[0]->mwfact = 0.9; + curtags[0]->mwfact = compute_new_value_from_arg(newarg, curtags[0]->mwfact); + + if(curtags[0]->mwfact < globalconf.screens[screen].mwfact_lower_limit) + curtags[0]->mwfact = globalconf.screens[screen].mwfact_lower_limit; + else if(curtags[0]->mwfact > globalconf.screens[screen].mwfact_upper_limit) + curtags[0]->mwfact = globalconf.screens[screen].mwfact_upper_limit; p_delete(&newarg); p_delete(&curtags); diff --git a/structs.h b/structs.h index 1b79300c..7ce0e4a2 100644 --- a/structs.h +++ b/structs.h @@ -253,6 +253,8 @@ typedef struct int snap; /** Border size */ int borderpx; + /** Mwfact limits */ + float mwfact_upper_limit, mwfact_lower_limit; /** Floating window placement algo */ FloatingPlacement *floating_placement; /** Respect resize hints */