st-fullscreen-0.8.5.diff (2110B)
1 diff -r -u a/config.def.h b/config.def.h 2 --- a/config.def.h 2022-01-07 06:41:35.000000000 -0500 3 +++ b/config.def.h 2022-01-15 13:32:01.644320198 -0500 4 @@ -201,6 +201,8 @@ 5 { TERMMOD, XK_Y, selpaste, {.i = 0} }, 6 { ShiftMask, XK_Insert, selpaste, {.i = 0} }, 7 { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, 8 + { XK_NO_MOD, XK_F11, fullscreen, {.i = 0} }, 9 + { MODKEY, XK_Return, fullscreen, {.i = 0} }, 10 }; 11 12 /* 13 diff -r -u a/st.h b/st.h 14 --- a/st.h 2022-01-07 06:41:35.000000000 -0500 15 +++ b/st.h 2022-01-15 13:32:40.084320514 -0500 16 @@ -81,6 +81,7 @@ 17 void redraw(void); 18 void draw(void); 19 20 +void fullscreen(const Arg *); 21 void printscreen(const Arg *); 22 void printsel(const Arg *); 23 void sendbreak(const Arg *); 24 diff -r -u a/x.c b/x.c 25 --- a/x.c 2022-01-07 06:41:35.000000000 -0500 26 +++ b/x.c 2022-01-15 13:50:28.164329295 -0500 27 @@ -94,6 +94,7 @@ 28 Drawable buf; 29 GlyphFontSpec *specbuf; /* font spec buffer used for rendering */ 30 Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid; 31 + Atom netwmstate, netwmfullscreen; 32 struct { 33 XIM xim; 34 XIC xic; 35 @@ -744,6 +745,24 @@ 36 xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec)); 37 } 38 39 +void 40 +fullscreen(const Arg *arg) 41 +{ 42 + XEvent ev; 43 + 44 + memset(&ev, 0, sizeof(ev)); 45 + 46 + ev.xclient.type = ClientMessage; 47 + ev.xclient.message_type = xw.netwmstate; 48 + ev.xclient.display = xw.dpy; 49 + ev.xclient.window = xw.win; 50 + ev.xclient.format = 32; 51 + ev.xclient.data.l[0] = 2; /* _NET_WM_STATE_TOGGLE */ 52 + ev.xclient.data.l[1] = xw.netwmfullscreen; 53 + 54 + XSendEvent(xw.dpy, DefaultRootWindow(xw.dpy), False, SubstructureNotifyMask|SubstructureRedirectMask, &ev); 55 +} 56 + 57 ushort 58 sixd_to_16bit(int x) 59 { 60 @@ -1208,6 +1227,9 @@ 61 XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, 62 PropModeReplace, (uchar *)&thispid, 1); 63 64 + xw.netwmstate = XInternAtom(xw.dpy, "_NET_WM_STATE", False); 65 + xw.netwmfullscreen = XInternAtom(xw.dpy, "_NET_WM_STATE_FULLSCREEN", False); 66 + 67 win.mode = MODE_NUMLOCK; 68 resettitle(); 69 xhints();