-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11-dwm-6.0-togglemax.diff
51 lines (48 loc) · 1.37 KB
/
11-dwm-6.0-togglemax.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Homepage: http://hg.punctweb.ro
--- a/dwm.c 2013-02-11 22:11:39.253773226 +0200
+++ b/dwm.c 2013-02-11 22:11:39.255773226 +0200
@@ -272,6 +272,7 @@ static void tagcycle(const Arg *arg);
static void gaplessgrid(Monitor *m);
static void pidgin(Monitor *m);
static void togglescratch(const Arg *arg);
+static void togglemax(const Arg *arg);
/* variables */
static const char broken[] = "broken";
@@ -2472,6 +2473,38 @@ togglescratch(const Arg *arg) {
spawn(arg);
}
+void
+togglemax(const Arg *arg) {
+ Client *c = selmon->sel;
+
+ if(!c)
+ return;
+ if(!c->isfullscreen) {
+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
+ PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
+ c->isfullscreen = True;
+ c->oldstate = c->isfloating;
+ c->oldbw = c->bw;
+ c->bw = 0;
+ c->isfloating = True;
+ resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+ XRaiseWindow(dpy, c->win);
+ }
+ else {
+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
+ PropModeReplace, (unsigned char*)0, 0);
+ c->isfullscreen = False;
+ c->isfloating = c->oldstate;
+ c->bw = c->oldbw;
+ c->x = c->oldx;
+ c->y = c->oldy;
+ c->w = c->oldw;
+ c->h = c->oldh;
+ resizeclient(c, c->x, c->y, c->w, c->h);
+ arrange(c->mon);
+ }
+}
+
int
main(int argc, char *argv[]) {
if(argc == 2 && !strcmp("-v", argv[1]))