diff --git a/config.def.h b/config.def.h index ee60191..a5abbcc 100644 --- a/config.def.h +++ b/config.def.h @@ -37,7 +37,6 @@ static const Rule rules[] = { /* layout(s) */ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static const int nmaster = 1; /* number of clients in master area */ static const Layout layouts[] = { /* symbol arrange function */ diff --git a/dwm.c b/dwm.c index 397e384..73b4e26 100644 --- a/dwm.c +++ b/dwm.c @@ -826,7 +826,7 @@ createmon(void) m = ecalloc(1, sizeof(Monitor)); m->tagset[0] = m->tagset[1] = 1; m->mfact = mfact; - m->nmaster = nmaster; + m->nmaster = settings_get_default_clients_in_master(); m->showbar = showbar; m->topbar = topbar; m->lt[0] = &layouts[0]; @@ -1630,7 +1630,7 @@ void resetnmaster(const Arg *arg) { const int max_clients_in_master = settings_get_max_clients_in_master(); - const int new_clients_in_master = arg->i == 0 ? 0 : nmaster; + const int new_clients_in_master = arg->i == 0 ? 0 : settings_get_default_clients_in_master(); selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = max_clients_in_master == 0 diff --git a/settings.c b/settings.c index 4308504..d7ceb5b 100644 --- a/settings.c +++ b/settings.c @@ -1,10 +1,21 @@ #include "settings.h" +static int default_clients_in_master = 1; static bool focus_on_wheel = true; static int max_clients_in_master = 0; // 0 for no maximum static bool respect_resize_hints_in_floating_layout = false; static unsigned int snap_distance = 32; +int settings_get_default_clients_in_master() +{ + return default_clients_in_master >= 1 ? default_clients_in_master : 1; +} + +void settings_set_default_clients_in_master(const int new_default_clients_in_master) +{ + default_clients_in_master = new_default_clients_in_master; +} + bool settings_get_focus_on_wheel() { return focus_on_wheel; diff --git a/settings.h b/settings.h index 22f8457..85a2fb6 100644 --- a/settings.h +++ b/settings.h @@ -3,6 +3,9 @@ #include +int settings_get_default_clients_in_master(); +void settings_set_default_clients_in_master(int new_default_clients_in_master); + bool settings_get_focus_on_wheel(); void settings_set_focus_on_wheel(bool new_focus_on_wheel);