dwm-defaultmfact-6.5.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-defaultmfact-6.5.diff (2016B)
       ---
            1 From 7c770d00c0010e93b37042e9fdff34e3d161ff15 Mon Sep 17 00:00:00 2001
            2 From: Rumen <rumenmitov@protonmail.com>
            3 Date: Fri, 3 Jan 2025 17:14:51 +0100
            4 Subject: [PATCH] patch: defaultmfact
            5 
            6 patch adds a default value for mfact, which can be used through
            7 setmfact
            8 ---
            9  config.def.h | 4 +++-
           10  dwm.c        | 7 +++++++
           11  2 files changed, 10 insertions(+), 1 deletion(-)
           12 
           13 diff --git a/config.def.h b/config.def.h
           14 index 9efa774..acb43cb 100644
           15 --- a/config.def.h
           16 +++ b/config.def.h
           17 @@ -32,7 +32,8 @@ static const Rule rules[] = {
           18  };
           19  
           20  /* layout(s) */
           21 -static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
           22 +#define DEFAULT_MFACT 0.55
           23 +static const float mfact     = DEFAULT_MFACT; /* factor of master area size [0.05..0.95] */
           24  static const int nmaster     = 1;    /* number of clients in master area */
           25  static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
           26  static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
           27 @@ -71,6 +72,7 @@ static const Key keys[] = {
           28          { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
           29          { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
           30          { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
           31 +        { MODKEY,                       XK_equal,  setmfact,       {.f = -1.0} },
           32          { MODKEY,                       XK_Return, zoom,           {0} },
           33          { MODKEY,                       XK_Tab,    view,           {0} },
           34          { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
           35 diff --git a/dwm.c b/dwm.c
           36 index 1443802..bf3a66e 100644
           37 --- a/dwm.c
           38 +++ b/dwm.c
           39 @@ -1521,9 +1521,16 @@ setlayout(const Arg *arg)
           40  }
           41  
           42  /* arg > 1.0 will set mfact absolutely */
           43 +/* arg <= -1.0 will set mfact to DEFAULT_MFACT */
           44  void
           45  setmfact(const Arg *arg)
           46  {
           47 +    if (arg->f <= -1.0) {
           48 +        selmon->mfact = DEFAULT_MFACT;
           49 +        arrange(selmon);
           50 +        return;
           51 +    }
           52 +
           53          float f;
           54  
           55          if (!arg || !selmon->lt[selmon->sellt]->arrange)
           56 -- 
           57 2.47.1
           58