Skip to content

Instantly share code, notes, and snippets.

@ropery
Created October 30, 2011 03:48
Show Gist options
  • Save ropery/1325440 to your computer and use it in GitHub Desktop.
Save ropery/1325440 to your computer and use it in GitHub Desktop.
void togglefullscreen(const Arg *arg);
void
togglefullscreen(const Arg *arg) {
Client *c = selmon->sel;
if(!c)
return;
if(!c->isfullscreen) {
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);
}
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment