sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-nmaxmaster-20210124-a04bfa8.diff (1417B)


      1 From a04bfa8a5add2a71939e13e36797ebacd0410e0d Mon Sep 17 00:00:00 2001
      2 From: Georgios Oxinos <georgios.oxinos.extern@elinvar.de>
      3 Date: Sun, 24 Jan 2021 16:12:26 +0100
      4 Subject: [PATCH] [dwm][patch] patch that adds limit to number of clients
      5  allowed in master area
      6 
      7 ---
      8  config.def.h | 1 +
      9  dwm.c        | 2 +-
     10  2 files changed, 2 insertions(+), 1 deletion(-)
     11 
     12 diff --git a/config.def.h b/config.def.h
     13 index 1c0b587..ef895e7 100644
     14 --- a/config.def.h
     15 +++ b/config.def.h
     16 @@ -5,6 +5,7 @@ static const unsigned int borderpx  = 1;        /* border pixel of windows */
     17  static const unsigned int snap      = 32;       /* snap pixel */
     18  static const int showbar            = 1;        /* 0 means no bar */
     19  static const int topbar             = 1;        /* 0 means bottom bar */
     20 +static const int nmaxmaster         = 3;        /* maximum number of clients allowed in master area */
     21  static const char *fonts[]          = { "monospace:size=10" };
     22  static const char dmenufont[]       = "monospace:size=10";
     23  static const char col_gray1[]       = "#222222";
     24 diff --git a/dwm.c b/dwm.c
     25 index 664c527..5b61eb3 100644
     26 --- a/dwm.c
     27 +++ b/dwm.c
     28 @@ -967,7 +967,7 @@ grabkeys(void)
     29  void
     30  incnmaster(const Arg *arg)
     31  {
     32 -	selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
     33 +  selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MIN(MAX(selmon->nmaster + arg->i, 0), nmaxmaster);
     34  	arrange(selmon);
     35  }
     36  
     37 -- 
     38 2.27.0
     39