[wiki] [sites] [dwm][patch][movecenter] new version fixing the crash when there's no selected window || GasparVardanyan

From: <git_AT_suckless.org>
Date: Sun, 01 Sep 2024 23:05:08 +0200

commit e9adab1822735457f42e8bb681f051c9269116e9
Author: GasparVardanyan <gaspar_pm_AT_proton.me>
Date: Mon Sep 2 01:03:27 2024 +0400

    [dwm][patch][movecenter] new version fixing the crash when there's no selected window

diff --git a/dwm.suckless.org/patches/movecenter/dwm-movecenter-6.5.diff b/dwm.suckless.org/patches/movecenter/dwm-movecenter-6.5.diff
new file mode 100644
index 00000000..b24977a3
--- /dev/null
+++ b/dwm.suckless.org/patches/movecenter/dwm-movecenter-6.5.diff
_AT_@ -0,0 +1,41 @@
+diff --git a/config.def.h b/config.def.h
+index 9efa774..89a958a 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -85,6 +85,7 @@ static const Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY, XK_x, movecenter, {0} },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff --git a/dwm.c b/dwm.c
+index f1d86b2..ad534ad 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -184,6 +184,7 @@ static void maprequest(XEvent *e);
+ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
++static void movecenter(const Arg *arg);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *c);
+ static void propertynotify(XEvent *e);
+_AT_@ -1202,6 +1203,16 @@ movemouse(const Arg *arg)
+ }
+ }
+
++void
++movecenter(const Arg *arg)
++{
++ if (selmon->sel) {
++ 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);
++ }
++}
++
+ Client *
+ nexttiled(Client *c)
+ {
diff --git a/dwm.suckless.org/patches/movecenter/index.md b/dwm.suckless.org/patches/movecenter/index.md
index f54323a4..13e8d90b 100644
--- a/dwm.suckless.org/patches/movecenter/index.md
+++ b/dwm.suckless.org/patches/movecenter/index.md
_AT_@ -16,6 +16,7 @@ Download
 --------
 * [dwm-movecenter-6.2.diff](dwm-movecenter-6.2.diff) - 2021-10-31
 * [dwm-movecenter-6.4.diff](dwm-movecenter-6.4.diff) - 2024-02-10
+* [dwm-movecenter-6.5.diff](dwm-movecenter-6.5.diff) - 2024-09-02
 
 Author
 ------
Received on Sun Sep 01 2024 - 23:05:08 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 01 2024 - 23:12:49 CEST