diff --git a/config.def.h b/config.def.h index 84b2c20..2df3d24 100644 --- a/config.def.h +++ b/config.def.h @@ -224,6 +224,8 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, + { XK_NO_MOD, XK_F11, fullscreen, {.i = 0} }, + { MODKEY, XK_Return, fullscreen, {.i = 0} }, }; /* diff --git a/st.h b/st.h index 5e9d4aa..345ddb5 100644 --- a/st.h +++ b/st.h @@ -83,6 +83,7 @@ void die(const char *, ...); void redraw(void); void draw(void); +void fullscreen(const Arg *); void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); diff --git a/x.c b/x.c index dba6f97..91082a2 100644 --- a/x.c +++ b/x.c @@ -97,6 +97,7 @@ typedef struct { Drawable buf; GlyphFontSpec *specbuf; /* font spec buffer used for rendering */ Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid; + Atom netwmstate, netwmfullscreen; struct { XIM xim; XIC xic; @@ -768,6 +769,24 @@ xresize(int col, int row) xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec)); } +void +fullscreen(const Arg *arg) +{ + XEvent ev; + + memset(&ev, 0, sizeof(ev)); + + ev.xclient.type = ClientMessage; + ev.xclient.message_type = xw.netwmstate; + ev.xclient.display = xw.dpy; + ev.xclient.window = xw.win; + ev.xclient.format = 32; + ev.xclient.data.l[0] = 2; /* _NET_WM_STATE_TOGGLE */ + ev.xclient.data.l[1] = xw.netwmfullscreen; + + XSendEvent(xw.dpy, DefaultRootWindow(xw.dpy), False, SubstructureNotifyMask|SubstructureRedirectMask, &ev); +} + ushort sixd_to_16bit(int x) { @@ -1348,6 +1367,9 @@ xinit(int cols, int rows) XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, PropModeReplace, (uchar *)&thispid, 1); + xw.netwmstate = XInternAtom(xw.dpy, "_NET_WM_STATE", False); + xw.netwmfullscreen = XInternAtom(xw.dpy, "_NET_WM_STATE_FULLSCREEN", False); + win.mode = MODE_NUMLOCK; resettitle(); xhints();