On Tue, Nov 1, 2011 at 5:59 AM, Connor Lane Smith <c...@lubutu.com> wrote: > > I sometimes wonder whether it would be simpler to just make > _NET_WM_STATE_FULLSCREEN switch dwm into monocle mode. Forcing one > window to be at the front very often leads me to accidentally focus > and interact with window hidden behind it. Which is why I think > floating windows ought to be able to be behind tiled windows, too.
For anyone interested in trying this out, I made a patch that implements this way of handling fullscreen windows. It should work with vanilla dwm. (r1586) It just replaces the setfullscreen function so the bar is hidden and the client is focused in monocle view. Windows usually don't ask for fullscreen when I don't want them too but maybe that's just me.
diff -r ee36ffbd4252 config.def.h --- a/config.def.h Sun Nov 06 20:36:23 2011 +0100 +++ b/config.def.h Wed Nov 09 22:01:37 2011 -0600 @@ -34,6 +34,9 @@ { "[M]", monocle }, }; +#define LAYOUT_DEFAULT layouts[0] +#define LAYOUT_FULLSCREEN layouts[2] + /* key definitions */ #define MODKEY Mod1Mask #define TAGKEYS(KEY,TAG) \ diff -r ee36ffbd4252 dwm.c --- a/dwm.c Sun Nov 06 20:36:23 2011 +0100 +++ b/dwm.c Wed Nov 09 22:01:37 2011 -0600 @@ -1510,30 +1510,31 @@ void setfullscreen(Client *c, Bool fullscreen) { + c->isfullscreen = fullscreen; + c->oldstate = c->isfloating; + c->isfloating = False; + + focus(c); + if(fullscreen) { XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, - PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); - c->isfullscreen = True; - c->oldstate = c->isfloating; - c->oldbw = c->bw; - c->bw = 0; - c->isfloating = True; - resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); - XRaiseWindow(dpy, c->win); + PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); + selmon->sellt ^= 1; + selmon->lt[selmon->sellt] = &LAYOUT_FULLSCREEN; + selmon->showbar = False; + } else { + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char*)0, 0); + selmon->sellt ^= 1; + selmon->showbar = True; } - else { - XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, - PropModeReplace, (unsigned char*)0, 0); - c->isfullscreen = False; - 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); - arrange(c->mon); - } + + updatebarpos(selmon); + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); + + arrange(selmon); } void diff -r ee36ffbd4252 config.def.h --- a/config.def.h Sun Nov 06 20:36:23 2011 +0100 +++ b/config.def.h Wed Nov 09 22:02:21 2011 -0600 @@ -34,6 +34,9 @@ { "[M]", monocle }, }; +#define LAYOUT_DEFAULT layouts[0] +#define LAYOUT_FULLSCREEN layouts[2] + /* key definitions */ #define MODKEY Mod1Mask #define TAGKEYS(KEY,TAG) \ diff -r ee36ffbd4252 dwm.c --- a/dwm.c Sun Nov 06 20:36:23 2011 +0100 +++ b/dwm.c Wed Nov 09 22:02:21 2011 -0600 @@ -1510,30 +1510,31 @@ void setfullscreen(Client *c, Bool fullscreen) { + c->isfullscreen = fullscreen; + c->oldstate = c->isfloating; + c->isfloating = False; + + focus(c); + if(fullscreen) { XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, - PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); - c->isfullscreen = True; - c->oldstate = c->isfloating; - c->oldbw = c->bw; - c->bw = 0; - c->isfloating = True; - resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); - XRaiseWindow(dpy, c->win); + PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); + selmon->sellt ^= 1; + selmon->lt[selmon->sellt] = &LAYOUT_FULLSCREEN; + selmon->showbar = False; + } else { + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char*)0, 0); + selmon->sellt ^= 1; + selmon->showbar = True; } - else { - XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, - PropModeReplace, (unsigned char*)0, 0); - c->isfullscreen = False; - 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); - arrange(c->mon); - } + + updatebarpos(selmon); + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); + + arrange(selmon); } void