about summary refs log tree commit diff
path: root/dwm.c
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-18 00:40:37 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-18 00:40:37 +0200
commit78c94bb7ba99bea753eca523afaadbd102ecc07d (patch)
treec235fc9f8c6e7f4d122c4d5afdf6b071d21096cb /dwm.c
parentFixed high temp icon in dwm-status (diff)
downloaddwm-78c94bb7ba99bea753eca523afaadbd102ecc07d.tar.gz
dwm-78c94bb7ba99bea753eca523afaadbd102ecc07d.tar.bz2
dwm-78c94bb7ba99bea753eca523afaadbd102ecc07d.zip
Added togglefullscreen patch and keybinding [Patch]
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index cdba5eb..c05ef8c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -218,6 +218,7 @@ static void tagmon(const Arg *arg);
 static void tile(Monitor *);
 static void togglebar(const Arg *arg);
 static void togglefloating(const Arg *arg);
+static void togglefullscreen(const Arg *arg);
 static void toggletag(const Arg *arg);
 static void toggleview(const Arg *arg);
 static void unfocus(Client *c, int setfocus);
@@ -1770,6 +1771,34 @@ togglefloating(const Arg *arg)
 }
 
 void
+togglefullscreen(const Arg *arg)
+{
+  if (!selmon->sel->isfullscreen) {
+		XChangeProperty(dpy, selmon->sel->win, netatom[NetWMState], XA_ATOM, 32,
+			PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
+		selmon->sel->isfullscreen = 1;
+		selmon->sel->oldstate = selmon->sel->isfloating;
+		selmon->sel->oldbw = selmon->sel->bw;
+		selmon->sel->bw = 0;
+		selmon->sel->isfloating = 1;
+		resizeclient(selmon->sel, selmon->sel->mon->mx, selmon->sel->mon->my, selmon->sel->mon->mw, selmon->sel->mon->mh);
+		XRaiseWindow(dpy, selmon->sel->win);
+	} else if (selmon->sel->isfullscreen){
+		XChangeProperty(dpy, selmon->sel->win, netatom[NetWMState], XA_ATOM, 32,
+			PropModeReplace, (unsigned char*)0, 0);
+		selmon->sel->isfullscreen = 0;
+		selmon->sel->isfloating = selmon->sel->oldstate;
+		selmon->sel->bw = selmon->sel->oldbw;
+		selmon->sel->x = selmon->sel->oldx;
+		selmon->sel->y = selmon->sel->oldy;
+		selmon->sel->w = selmon->sel->oldw;
+		selmon->sel->h = selmon->sel->oldh;
+		resizeclient(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h);
+		arrange(selmon->sel->mon);
+	}
+}
+
+void
 toggletag(const Arg *arg)
 {
 	unsigned int newtags;