Commit: 902fca7b88f62c3eb3fea330661a30d935df2223
Parent: fcb2476b693ca4c40ad32c7119e27bbeb856865c
Author: Randy Palamar
Date: Sat, 13 Feb 2021 15:42:19 -0700
add fake fullscreen back in with a keybind to toggle
this was actually a bug that got fixed in but I actually liked it.
you can use this to fullscreen a video in your browser (removing
clutter from the rest of the page) while keeping the window bound to
its frame
Diffstat:
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -17,6 +17,7 @@ static const char *colors[][3] = {
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
+static int fakefullscreen = 1;
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
@@ -79,6 +80,7 @@ static const Key keys[] = {
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY|ShiftMask, XK_y, togglefakefull, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
diff --git a/dwm.c b/dwm.c
@@ -187,6 +187,7 @@ static Client *nexttiled(Client *c);
static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
+static void togglefakefull(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
@@ -566,9 +567,10 @@ configurenotify(XEvent *e)
drw_resize(drw, sw, bh);
updatebars();
for (m = mons; m; m = m->next) {
- for (c = m->clients; c; c = c->next)
- if (c->isfullscreen)
- resizeclient(c, m->mx, m->my, m->mw, m->mh);
+ if (!fakefullscreen)
+ for (c = m->clients; c; c = c->next)
+ if (c->isfullscreen)
+ resizeclient(c, m->mx, m->my, m->mw, m->mh);
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
focus(NULL);
@@ -1485,6 +1487,10 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = 1;
+
+ if (fakefullscreen)
+ return;
+
c->oldstate = c->isfloating;
c->oldbw = c->bw;
c->bw = 0;
@@ -1495,6 +1501,10 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
+
+ if (fakefullscreen)
+ return;
+
c->isfloating = c->oldstate;
c->bw = c->oldbw;
c->x = c->oldx;
@@ -1633,7 +1643,7 @@ showhide(Client *c)
if (ISVISIBLE(c)) {
/* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y);
- if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
+ if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && fakefullscreen && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0);
showhide(c->snext);
} else {
@@ -1735,6 +1745,12 @@ togglefloating(const Arg *arg)
}
void
+togglefakefull(const Arg *arg)
+{
+ fakefullscreen = !fakefullscreen;
+}
+
+void
toggletag(const Arg *arg)
{
unsigned int newtags;