commit 941da2e375f8d351d8b6105d83ca9406eff04374
parent 365eb055580d8c47d3b6cd47880629cf747a7536
Author: Rizqi Nur Assyaufi <bandithijo@gmail.com>
Date: Fri, 6 Aug 2021 14:49:05 +0800
[dwm][patch][togglefloatingcenter] centered togglefloating window
Default behaviour when togglefoating() is floating from top-left corner.
This patch will allows you to toggle floating window client will be centered
position.
Diffstat:
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/togglefloatingcenter/dwm-togglefloatingcenter-20210806-61bb8b22.diff b/dwm.suckless.org/patches/togglefloatingcenter/dwm-togglefloatingcenter-20210806-61bb8b22.diff
@@ -0,0 +1,29 @@
+commit d3060fef380723635f2d3bb39ae697cd0fdde30d (HEAD -> togglefloatingcenter)
+Author: Rizqi Nur Assyaufi <bandithijo@gmail.com>
+Date: Fri Aug 6 14:37:10 2021 +0800
+Subject: [patch][togglefloatingcenter] centered togglefloating window
+
+Default behaviour when togglefoating() is floating from top-left corner.
+This patch will allows you to toggle floating window client will be centered
+position.
+
+---
+ dwm.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/dwm.c b/dwm.c
+index 664c527..5234d4b 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1719,6 +1719,10 @@ togglefloating(const Arg *arg)
+ if (selmon->sel->isfloating)
+ resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+ selmon->sel->w, selmon->sel->h, 0);
++
++ selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
++ selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
++
+ arrange(selmon);
+ }
+--
+2.31.1
diff --git a/dwm.suckless.org/patches/togglefloatingcenter/index.md b/dwm.suckless.org/patches/togglefloatingcenter/index.md
@@ -0,0 +1,18 @@
+togglefloatingcenter
+============
+
+Description
+-----------
+Default behaviour when togglefoating() is floating from top-left corner.
+This patch will allows you to toggle floating window client will be centered
+position.
+
+The original code is from [alwayscenter](../alwayscenter/) patch.
+
+Download
+--------
+* [dwm-togglefloatingcenter-20210806-61bb8b22.diff](dwm-togglefloatingcenter-20210806-61bb8b22.diff)
+
+Author
+------
+* Rizqi Nur Assyaufi - <bandithijo@gmail.com>