summaryrefslogtreecommitdiff
path: root/patches/dwm-fullscreen.diff
blob: 27e437d59bf8f012a5ec1efc7676ee5030ae823e (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
diff --git a/config.def.h b/config.def.h
index 1c0b587..b859e78 100644
--- a/config.def.h
+++ b/config.def.h
@@ -34,7 +34,7 @@ static const Rule rules[] = {
 /* layout(s) */
 static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
 static const int nmaster     = 1;    /* number of clients in master area */
-static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
+static const int resizehints = 0;    /* 1 means respect size hints in tiled resizals */
 
 static const Layout layouts[] = {
 	/* symbol     arrange function */
@@ -76,6 +76,7 @@ static Key keys[] = {
 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
+	{ MODKEY|ShiftMask,             XK_f,      fullscreen,     {0} },
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 4465af1..ce893d0 100644
--- a/dwm.c
+++ b/dwm.c
@@ -199,6 +199,7 @@ static void sendmon(Client *c, Monitor *m);
 static void setclientstate(Client *c, long state);
 static void setfocus(Client *c);
 static void setfullscreen(Client *c, int fullscreen);
+static void fullscreen(const Arg *arg);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
@@ -267,6 +268,8 @@ static Display *dpy;
 static Drw *drw;
 static Monitor *mons, *selmon;
 static Window root, wmcheckwin;
+static Layout *last_layout;
+
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -1497,6 +1500,28 @@ setfullscreen(Client *c, int fullscreen)
 	}
 }
 
+void
+fullscreen(const Arg *arg)
+{
+	XWindowChanges wc;
+	if (selmon->showbar) {
+		for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
+		setlayout(&((Arg) { .v = &layouts[2] }));
+        selmon->sel->bw = 0;
+        selmon->showbar = 0;
+	} else {
+		setlayout(&((Arg) { .v = last_layout }));
+        selmon->sel->bw = borderpx;
+        selmon->showbar = 1;
+	}
+    updatebarpos(selmon);
+    wc.border_width = selmon->sel->bw;
+    XConfigureWindow(dpy, selmon->sel->win, CWBorderWidth, &wc);
+	XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeNorm][ColBorder].pixel);
+    XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+    arrange(selmon);
+}
+
 void
 setlayout(const Arg *arg)
 {