aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.def.h1
-rw-r--r--config.h1
-rw-r--r--st.15
-rw-r--r--st.desktop13
-rw-r--r--st.h1
-rw-r--r--x.c40
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} },
};
/*
diff --git a/config.h b/config.h
index 96e97f4..3cf53c4 100644
--- a/config.h
+++ b/config.h
@@ -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} },
};
/*
diff --git a/st.1 b/st.1
index 39120b4..29a7885 100644
--- a/st.1
+++ b/st.1
@@ -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
diff --git a/st.desktop b/st.desktop
index 77c672a..0ba7746 100644
--- a/st.desktop
+++ b/st.desktop
@@ -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
diff --git a/st.h b/st.h
index aef72ef..10c4378 100644
--- a/st.h
+++ b/st.h
@@ -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);
diff --git a/x.c b/x.c
index 988bded..4fbec04 100644
--- a/x.c
+++ b/x.c
@@ -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);