dwm-movecenter-6.4.diff (1716B)
1 From 2eb73abfbc2a81ac5f6548ebc9b3db660d1be179 Mon Sep 17 00:00:00 2001 2 From: Philip Thomas Kanianthara <philip.kanianthara@gmail.com> 3 Date: Fri, 9 Feb 2024 14:18:00 +0800 4 Subject: [PATCH] Applied movecenter patch manually, with compile check 5 6 --- 7 config.def.h | 1 + 8 dwm.c | 9 +++++++++ 9 2 files changed, 10 insertions(+) 10 11 diff --git a/config.def.h b/config.def.h 12 index 061ad66..0b767a7 100644 13 --- a/config.def.h 14 +++ b/config.def.h 15 @@ -84,6 +84,7 @@ static const Key keys[] = { 16 { MODKEY, XK_period, focusmon, {.i = +1 } }, 17 { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, 18 { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, 19 + { MODKEY, XK_x, movecenter, {0} }, 20 TAGKEYS( XK_1, 0) 21 TAGKEYS( XK_2, 1) 22 TAGKEYS( XK_3, 2) 23 diff --git a/dwm.c b/dwm.c 24 index e5efb6a..e6846a2 100644 25 --- a/dwm.c 26 +++ b/dwm.c 27 @@ -184,6 +184,7 @@ static void maprequest(XEvent *e); 28 static void monocle(Monitor *m); 29 static void motionnotify(XEvent *e); 30 static void movemouse(const Arg *arg); 31 +static void movecenter(const Arg *arg); 32 static Client *nexttiled(Client *c); 33 static void pop(Client *c); 34 static void propertynotify(XEvent *e); 35 @@ -1193,6 +1194,14 @@ movemouse(const Arg *arg) 36 } 37 } 38 39 +void 40 +movecenter(const Arg *arg) 41 +{ 42 + selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2; 43 + selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2; 44 + arrange(selmon); 45 +} 46 + 47 Client * 48 nexttiled(Client *c) 49 { 50 -- 51 2.34.1 52