sites

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

dwm-togglefloatingcenter-20210806-61bb8b22.diff (956B)


      1 commit d3060fef380723635f2d3bb39ae697cd0fdde30d (HEAD -> togglefloatingcenter)
      2 Author: Rizqi Nur Assyaufi <bandithijo@gmail.com>
      3 Date:   Fri Aug 6 14:37:10 2021 +0800
      4 Subject: [patch][togglefloatingcenter] centered togglefloating window
      5 
      6 Default behaviour when togglefoating() is floating from top-left corner.
      7 This patch will allows you to toggle floating window client will be centered
      8 position.
      9 
     10 ---
     11  dwm.c | 4 ++++
     12  1 file changed, 4 insertions(+)
     13 
     14 diff --git a/dwm.c b/dwm.c
     15 index 664c527..5234d4b 100644
     16 --- a/dwm.c
     17 +++ b/dwm.c
     18 @@ -1719,6 +1719,10 @@ togglefloating(const Arg *arg)
     19     if (selmon->sel->isfloating)
     20         resize(selmon->sel, selmon->sel->x, selmon->sel->y,
     21             selmon->sel->w, selmon->sel->h, 0);
     22 +
     23 +    selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
     24 +    selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
     25 +
     26     arrange(selmon);
     27  }
     28 --
     29 2.31.1