[dwm][patches][ifroot] - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 39a23421c0017f93ced262bff70a97521c592302
 (DIR) parent 06394d148d8346aad2e68fb971d1bcb9549f8d2d
 (HTM) Author: elbachir-one <bachiralfa@gmail.com>
       Date:   Wed,  8 Oct 2025 17:39:38 +0100
       
       [dwm][patches][ifroot]
       
       - Fixed index.md and patch indentation
       
       Diffstat:
         M dwm.suckless.org/patches/ifroot/dw… |      22 +++++++++++-----------
         M dwm.suckless.org/patches/ifroot/in… |       9 +++++----
       
       2 files changed, 16 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/dwm.suckless.org/patches/ifroot/dwm-ifroot-6.6.diff b/dwm.suckless.org/patches/ifroot/dwm-ifroot-6.6.diff
       @@ -18,7 +18,7 @@ index 81c3fc0..afc21ec 100644
                 { MODKEY,                       XK_Return, zoom,           {0} },
                 { MODKEY,                       XK_Tab,    view,           {0} },
        -        { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
       -+  { MODKEY|ShiftMask,             XK_c,      ifroot,         {.v = &(TwoFuncPtr){quit, killclient, {0}, {0} } } },
       ++        { MODKEY|ShiftMask,             XK_c,      ifroot,         {.v = &(TwoFuncPtr){quit, killclient, {0}, {0} } } },
                 { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
                 { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
                 { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
       @@ -31,10 +31,10 @@ index 4f345ee..b144e90 100644
         } Rule;
         
        +typedef struct {
       -+  void (*func1)(const Arg *arg);
       -+  void (*func2)(const Arg *arg);
       -+  const Arg arg1;
       -+  const Arg arg2;
       ++        void (*func1)(const Arg *arg);
       ++        void (*func2)(const Arg *arg);
       ++        const Arg arg1;
       ++        const Arg arg2;
        +} TwoFuncPtr;
        +
         /* function declarations */
       @@ -55,12 +55,12 @@ index 4f345ee..b144e90 100644
        +void
        +ifroot(const Arg *arg)
        +{
       -+  TwoFuncPtr *funcs = (TwoFuncPtr*)arg->v;
       -+  if (!selmon->sel) { /*no client -> root window*/
       -+    funcs->func1(&(funcs->arg1));
       -+    return;
       -+  } /*client window*/
       -+  funcs->func2(&(funcs->arg2));
       ++        TwoFuncPtr *funcs = (TwoFuncPtr*)arg->v;
       ++        if (!selmon->sel) { /*no client -> root window*/
       ++                funcs->func1(&(funcs->arg1));
       ++                return;
       ++        } /*client window*/
       ++        funcs->func2(&(funcs->arg2));
        +}
        +
         void
 (DIR) diff --git a/dwm.suckless.org/patches/ifroot/index.md b/dwm.suckless.org/patches/ifroot/index.md
       @@ -1,11 +1,12 @@
        ifroot
       -=============
       +======
        
        Description
        -----------
       -Adds the ifroot function which can assign two functions to one keybind.
       -The first function passed to ifroot will be invoked if no client is focused, the second if there is one.
       -It is mainly intended to be used for using the same keybinding to close windows and quit dwm or open the power menu.
       +Adds the `ifroot` function, which allows assigning two actions to a single keybinding.
       +The first action is executed when no client is focused, and the second when a client
       +is focused. This is mainly intended for using the same keybinding to close windows,
       +quit dwm, or open the power menu.
        
        Download
        --------