dwm-movecenter-6.5.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-movecenter-6.5.diff (1401B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 9efa774..89a958a 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -85,6 +85,7 @@ static const Key keys[] = {
6 { MODKEY, XK_period, focusmon, {.i = +1 } },
7 { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
8 { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
9 + { MODKEY, XK_x, movecenter, {0} },
10 TAGKEYS( XK_1, 0)
11 TAGKEYS( XK_2, 1)
12 TAGKEYS( XK_3, 2)
13 diff --git a/dwm.c b/dwm.c
14 index f1d86b2..ad534ad 100644
15 --- a/dwm.c
16 +++ b/dwm.c
17 @@ -184,6 +184,7 @@ static void maprequest(XEvent *e);
18 static void monocle(Monitor *m);
19 static void motionnotify(XEvent *e);
20 static void movemouse(const Arg *arg);
21 +static void movecenter(const Arg *arg);
22 static Client *nexttiled(Client *c);
23 static void pop(Client *c);
24 static void propertynotify(XEvent *e);
25 @@ -1202,6 +1203,16 @@ movemouse(const Arg *arg)
26 }
27 }
28
29 +void
30 +movecenter(const Arg *arg)
31 +{
32 + if (selmon->sel) {
33 + selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
34 + selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
35 + arrange(selmon);
36 + }
37 +}
38 +
39 Client *
40 nexttiled(Client *c)
41 {