From 7b1c7a8c6788f28d15dbe7be330bf11bcdd16cb8 Mon Sep 17 00:00:00 2001 From: Georgios Oxinos Date: Sun, 24 Jan 2021 16:15:57 +0100 Subject: [PATCH] [dwm][patch] patch that adds limit to number of clients allowed in master area --- config.def.h | 1 + dwm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index 1c0b587..ef895e7 100644 --- a/config.def.h +++ b/config.def.h @@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ +static const int nmaxmaster = 3; /* maximum number of clients allowed in master area */ static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#222222"; diff --git a/dwm.c b/dwm.c index 4465af1..64fd1f7 100644 --- a/dwm.c +++ b/dwm.c @@ -966,7 +966,7 @@ grabkeys(void) void incnmaster(const Arg *arg) { - selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); + selmon->nmaster = MIN(MAX(selmon->nmaster + arg->i, 0), nmaxmaster); arrange(selmon); } -- 2.27.0