Add mwfact_lower_limit and mwfact_upper_limit to configure limits of mwfact value
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
6161fc2130
commit
8a685bf177
|
@ -564,6 +564,8 @@ screen <integer> [MULTI]
|
|||
sloppy_focus_raise = <boolean>
|
||||
snap = <integer>
|
||||
floating_placement = <{smart,under_mouse}>
|
||||
mwfact_lower_limit = <float>
|
||||
mwfact_upper_limit = <float>
|
||||
}
|
||||
tags
|
||||
{
|
||||
|
|
|
@ -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[] =
|
||||
|
|
24
config.c
24
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"));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue