dwm-togglefloatingcenter-20210806-138b405f.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-togglefloatingcenter-20210806-138b405f.diff (946B)
---
1 From efa326b2c71f0df1d097fd52a17684f5ccc5df6c Mon Sep 17 00:00:00 2001
2 From: Rizqi Nur Assyaufi <bandithijo@gmail.com>
3 Date: Sat, 7 Aug 2021 00:24:01 +0800
4 Subject: [PATCH] [dwm][patch][togglefloatingcenter] centered togglefloating
5 window
6
7 Default behaviour when togglefloating() is floating from top-left corner.
8 This patch will allows you to toggle floating window client will be centered
9 position.
10 ---
11 dwm.c | 4 ++++
12 1 file changed, 4 insertions(+)
13
14 diff --git a/dwm.c b/dwm.c
15 index 5e4d494..cbedb09 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 --
30 2.31.1
31