summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorMouad Alami <moadalami40@gmail.com>2023-09-13 15:15:52 +0100
committerMouad Alami <moadalami40@gmail.com>2023-09-13 15:15:52 +0100
commit489d8330177b8dd06cf5d540289201c5febb8679 (patch)
tree32c71bb0ad9b3a6b65e26c799dc58c75afb78610 /dwm.c
parent5793570a1979aaa2a4bba587277e89f47f13a534 (diff)
togglefakefullscreen patch by bakkeby
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c61
1 files changed, 54 insertions, 7 deletions
diff --git a/dwm.c b/dwm.c
index 9ff14bd..540d30a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -94,6 +94,7 @@ struct Client {
int bw, oldbw;
unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky;
+ int fakefullscreen;
Client *next;
Client *snext;
Monitor *mon;
@@ -221,6 +222,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglealttag(const Arg *arg);
static void togglebar(const Arg *arg);
+static void togglefakefullscreen(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglesticky(const Arg *arg);
static void togglefullscr(const Arg *arg);
@@ -639,7 +641,7 @@ configurenotify(XEvent *e)
updatebars();
for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next)
- if (c->isfullscreen)
+ if (c->isfullscreen && c->fakefullscreen != 1)
resizeclient(c, m->mx, m->my, m->mw, m->mh);
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
@@ -1327,7 +1329,7 @@ movemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
- if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
+ if (c->isfullscreen && c->fakefullscreen != 1) /* no support moving fullscreen windows by mouse */
return;
restack(selmon);
ocx = c->x;
@@ -1476,7 +1478,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
}
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
- XSync(dpy, False);
+ if (c->fakefullscreen == 1)
+ XSync(dpy, True);
+ else
+ XSync(dpy, False);
}
void
@@ -1490,7 +1495,7 @@ resizemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
- if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
+ if (c->isfullscreen && c->fakefullscreen != 1) /* no support resizing fullscreen windows by mouse */
return;
restack(selmon);
ocx = c->x;
@@ -1668,8 +1673,10 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = 1;
- c->oldstate = c->isfloating;
c->oldbw = c->bw;
+ if (c->fakefullscreen == 1)
+ return;
+ c->oldstate = c->isfloating;
c->bw = 0;
c->isfloating = 1;
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
@@ -1678,8 +1685,12 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
- c->isfloating = c->oldstate;
c->bw = c->oldbw;
+ if (c->fakefullscreen == 1)
+ return;
+ if (c->fakefullscreen == 2)
+ c->fakefullscreen = 1;
+ c->isfloating = c->oldstate;
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
@@ -1943,11 +1954,47 @@ togglebar(const Arg *arg)
}
void
+togglefakefullscreen(const Arg *arg)
+{
+ Client *c = selmon->sel;
+ if (!c)
+ return;
+
+ if (c->fakefullscreen) {
+ if (c->isfullscreen) {
+ if (c->isfloating && c->fakefullscreen == 1) {
+ c->oldstate = c->isfloating;
+ c->oldx = c->x;
+ c->oldy = c->y;
+ c->oldw = c->w;
+ c->oldh = c->h;
+ }
+ c->fakefullscreen = 0;
+ }
+ else
+ c->isfullscreen = 0;
+ } else {
+ c->fakefullscreen = 1;
+ if (c->isfullscreen) {
+ 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);
+ }
+ c->isfullscreen = 0;
+ }
+ setfullscreen(c, !c->isfullscreen);
+}
+
+void
togglefloating(const Arg *arg)
{
if (!selmon->sel)
return;
- if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
+ if (selmon->sel->isfullscreen && selmon->sel->fakefullscreen != 1) /* no support for fullscreen windows */
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)