diff options
| author | Shivesh Mandalia <mail@shivesh.org> | 2023-02-11 22:33:25 +0000 |
|---|---|---|
| committer | Shivesh Mandalia <mail@shivesh.org> | 2023-02-11 22:33:25 +0000 |
| commit | 97817658a8da2a0fec6db04a219632cf7664c3f6 (patch) | |
| tree | 0f8878f6714fba2ff1462d436f2899ce554aaf59 | |
| parent | 1c3039d21a53d533991a316816d0b7a5c5fdbc51 (diff) | |
| download | st-shivesh.tar.gz st-shivesh.zip | |
| -rw-r--r-- | config.def.h | 1 | ||||
| -rw-r--r-- | config.h | 1 | ||||
| -rw-r--r-- | st.1 | 5 | ||||
| -rw-r--r-- | st.desktop | 13 | ||||
| -rw-r--r-- | st.h | 1 | ||||
| -rw-r--r-- | x.c | 40 |
6 files changed, 55 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h index 6c25f09..75dd8c3 100644 --- a/config.def.h +++ b/config.def.h @@ -221,6 +221,7 @@ 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} }, }; /* @@ -222,6 +222,7 @@ 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} }, }; /* @@ -63,6 +63,9 @@ defines the .I font to use when st is run. .TP +.B \-m +open st fully maximized +.TP .BI \-g " geometry" defines the X11 geometry string. The form is [=][<cols>{xX}<rows>][{+-}<xoffset>{+-}<yoffset>]. See @@ -159,6 +162,8 @@ Copy the selected text to the clipboard selection. .TP .B Ctrl-Shift-v Paste from the clipboard selection. +.B F11 +Enter fullscreen mode. .SH CUSTOMIZATION .B st can be customized by creating a custom config.h and (re)compiling the source @@ -1,8 +1,17 @@ [Desktop Entry] Name=st +GenericName=Terminal Comment=st is a simple terminal implementation for X -Exec=st -e /bin/bash --login +Keywords=shell;prompt;command;commandline;cmd; +TryExec=st +Exec=st -m Icon=utilities-terminal -Terminal=false Type=Application Categories=System;TerminalEmulator; +StartupNotify=true +StartupWMClass=st-256color +Actions=new-window; + +[Desktop Action new-window] +Name=New Window +Exec=st @@ -87,6 +87,7 @@ void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); void toggleprinter(const Arg *); +void fullscreen(const Arg *); int tattrset(int); int tisaltscr(void); @@ -95,6 +95,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; @@ -258,6 +259,8 @@ static char *opt_title = NULL; static uint buttons; /* bit field of pressed buttons */ static int cursorblinks = 0; +static int maximize = 0; + void clipcopy(const Arg *dummy) { @@ -766,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) { @@ -1256,8 +1277,13 @@ xinit(int cols, int rows) xloadcols(); /* adjust fixed window geometry */ - win.w = 2 * borderpx + cols * win.cw; - win.h = 2 * borderpx + rows * win.ch; + if (maximize) { + win.w = DisplayWidth(xw.dpy, xw.scr); + win.h = DisplayHeight(xw.dpy, xw.scr); + } else { + win.w = 2 * borderpx + cols * win.cw; + win.h = 2 * borderpx + rows * win.ch; + } if (xw.gm & XNegative) xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; if (xw.gm & YNegative) @@ -1328,6 +1354,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(); @@ -2142,11 +2171,11 @@ run(void) void usage(void) { - die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]" + die("usage: %s [-aimv] [-c class] [-f font] [-g geometry]" " [-n name] [-o file]\n" " [-T title] [-t title] [-w windowid]" " [[-e] command [args ...]]\n" - " %s [-aiv] [-c class] [-f font] [-g geometry]" + " %s [-aimv] [-c class] [-f font] [-g geometry]" " [-n name] [-o file]\n" " [-T title] [-t title] [-w windowid] -l line" " [stty_args ...]\n", argv0, argv0); @@ -2173,6 +2202,9 @@ main(int argc, char *argv[]) case 'f': opt_font = EARGF(usage()); break; + case 'm': + maximize = 1; + break; case 'g': xw.gm = XParseGeometry(EARGF(usage()), &xw.l, &xw.t, &cols, &rows); |
