[PATCH] Selective fake full screen

This commit is contained in:
Francisco Tapia 2022-01-10 22:09:30 +01:00 committed by Przemek Grondek
parent bb6ccde971
commit 50514a2e9a
2 changed files with 27 additions and 11 deletions

View File

@ -31,10 +31,10 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating isterminal noswallow ignoretransient monitor */
{ "Gimp", NULL, NULL, 0, 1, 0, 0, 0, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, 0, -1 },
{ "st", NULL, NULL, 0, 0, 1, 1, 0, -1 },
/* class instance title tags mask isfloating isfakefullscreen isterminal noswallow ignoretransient monitor */
{ "Gimp", NULL, NULL, 0, 1, 0, 0, 0, 0, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, 1, 0, 0, 0, -1 },
{ "st", NULL, NULL, 0, 0, 0, 1, 1, 0, -1 },
};
/* layout(s) */

30
dwm.c
View File

@ -113,7 +113,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow, ignoretransient;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen, isterminal, noswallow, ignoretransient;
pid_t pid;
Client *next;
Client *snext;
@ -162,6 +162,7 @@ typedef struct {
const char *title;
unsigned int tags;
int isfloating;
int isfakefullscreen;
int isterminal;
int noswallow;
int ignoretransient;
@ -357,6 +358,7 @@ applyrules(Client *c)
{
c->isterminal = r->isterminal;
c->isfloating = r->isfloating;
c->isfakefullscreen = r->isfakefullscreen;
c->ignoretransient = r->ignoretransient;
c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next);
@ -692,7 +694,8 @@ clientmessage(XEvent *e)
if (cme->data.l[1] == netatom[NetWMFullscreen]
|| cme->data.l[2] == netatom[NetWMFullscreen])
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */
&& (!c->isfullscreen || c->isfakefullscreen))));
} else if (cme->message_type == netatom[NetActiveWindow]) {
if (c != selmon->sel && !c->isurgent)
seturgent(c, 1);
@ -736,7 +739,8 @@ 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->isfakefullscreen)
resizeclient(c, m->mx, m->my, m->mw, m->mh);
resizebarwin(m);
}
@ -1357,7 +1361,8 @@ movemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
if (c->isfullscreen
&& !c->isfakefullscreen) /* no support moving fullscreen windows by mouse */
return;
restack(selmon);
ocx = c->x;
@ -1562,7 +1567,8 @@ resizemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
if (c->isfullscreen
&& !c->isfakefullscreen) /* no support resizing fullscreen windows by mouse */
return;
restack(selmon);
ocx = c->x;
@ -1763,6 +1769,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 (c->isfakefullscreen) {
resizeclient(c, c->x, c->y, c->w, c->h);
return;
}
c->oldstate = c->isfloating;
c->oldbw = c->bw;
c->bw = 0;
@ -1773,6 +1783,10 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
if (c->isfakefullscreen) {
resizeclient(c, c->x, c->y, c->w, c->h);
return;
}
c->isfloating = c->oldstate;
c->bw = c->oldbw;
c->x = c->oldx;
@ -1937,7 +1951,8 @@ 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)
&& (!c->isfullscreen || c->isfakefullscreen))
resize(c, c->x, c->y, c->w, c->h, 0);
showhide(c->snext);
} else {
@ -2066,7 +2081,8 @@ togglefloating(const Arg *arg)
{
if (!selmon->sel)
return;
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
if (selmon->sel->isfullscreen
&& !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)