-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20-dwm-6.0-centerwindow.diff
29 lines (26 loc) · 1.02 KB
/
20-dwm-6.0-centerwindow.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Homepage: http://hg.punctweb.ro
--- a/dwm.c 2013-02-11 22:11:39.372773221 +0200
+++ b/dwm.c 2013-02-11 22:11:39.375773221 +0200
@@ -314,6 +314,7 @@ static void updatesystray(void);
static void updatesystrayicongeom(Client *i, int w, int h);
static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
static Client *wintosystrayicon(Window w);
+static void centerwindow(const Arg *arg);
/* variables */
static const char broken[] = "broken";
@@ -2929,6 +2930,16 @@ wintosystrayicon(Window w) {
return i;
}
+void
+centerwindow(const Arg *arg) {
+ if(!selmon->sel || !selmon->sel->isfloating || selmon->sel->isfullscreen)
+ return;
+ selmon->sel->x = selmon->sel->oldx = selmon->wx + (selmon->ww / 2 - selmon->sel->w / 2);
+ selmon->sel->y = selmon->sel->oldy = selmon->wy + (selmon->wh / 2 - selmon->sel->h / 2);
+ XMoveResizeWindow(dpy, selmon->sel->win, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h);
+ arrange(selmon);
+}
+
int
main(int argc, char *argv[]) {
if(argc == 2 && !strcmp("-v", argv[1]))