aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-09-16 21:50:58 +0200
committerpml68 <contact@pml68.dev>2025-09-16 22:15:01 +0200
commit6a21c5cf1730eab223ae9b3d1fa6009675279fce (patch)
tree3aa32a3d5db32fb66bc067a493fc450123a55c67
parentchore: sync slstatus with upstream (diff)
downloadsuckless-setup-6a21c5cf1730eab223ae9b3d1fa6009675279fce.tar.gz
chore: sync st with upstream
-rw-r--r--st/config.def.h2
-rw-r--r--st/config.h2
-rw-r--r--st/config.mk2
-rw-r--r--st/st.17
-rw-r--r--st/st.c35
-rw-r--r--st/st.h1
-rw-r--r--st/x.c47
7 files changed, 72 insertions, 24 deletions
diff --git a/st/config.def.h b/st/config.def.h
index 2e6ae5f..444c838 100644
--- a/st/config.def.h
+++ b/st/config.def.h
@@ -53,7 +53,7 @@ int allowwindowops = 0;
* near minlatency, but it waits longer for slow updates to avoid partial draw.
* low minlatency will tear/flicker more, as it can "detect" idle too early.
*/
-static double minlatency = 8;
+static double minlatency = 2;
static double maxlatency = 33;
/*
diff --git a/st/config.h b/st/config.h
index 2e6ae5f..444c838 100644
--- a/st/config.h
+++ b/st/config.h
@@ -53,7 +53,7 @@ int allowwindowops = 0;
* near minlatency, but it waits longer for slow updates to avoid partial draw.
* low minlatency will tear/flicker more, as it can "detect" idle too early.
*/
-static double minlatency = 8;
+static double minlatency = 2;
static double maxlatency = 33;
/*
diff --git a/st/config.mk b/st/config.mk
index 47c615e..db31d85 100644
--- a/st/config.mk
+++ b/st/config.mk
@@ -1,5 +1,5 @@
# st version
-VERSION = 0.9
+VERSION = 0.9.3
# Customize below to fit your system
diff --git a/st/st.1 b/st/st.1
index 39120b4..88e4507 100644
--- a/st/st.1
+++ b/st/st.1
@@ -4,6 +4,8 @@ st \- simple terminal
.SH SYNOPSIS
.B st
.RB [ \-aiv ]
+.RB [ \-A
+.IR alpha ]
.RB [ \-c
.IR class ]
.RB [ \-f
@@ -28,6 +30,8 @@ st \- simple terminal
.PP
.B st
.RB [ \-aiv ]
+.RB [ \-A
+.IR alpha ]
.RB [ \-c
.IR class ]
.RB [ \-f
@@ -55,6 +59,9 @@ is a simple terminal emulator.
.B \-a
disable alternate screens in terminal
.TP
+.BI \-A " alpha"
+defines the window's opacity.
+.TP
.BI \-c " class"
defines the window class (default $TERM).
.TP
diff --git a/st/st.c b/st/st.c
index d6478f5..e9fea17 100644
--- a/st/st.c
+++ b/st/st.c
@@ -1132,6 +1132,7 @@ csiparse(void)
{
char *p = csiescseq.buf, *np;
long int v;
+ int sep = ';'; /* colon or semi-colon, but not both */
csiescseq.narg = 0;
if (*p == '?') {
@@ -1149,7 +1150,9 @@ csiparse(void)
v = -1;
csiescseq.arg[csiescseq.narg++] = v;
p = np;
- if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ)
+ if (sep == ';' && *p == ':')
+ sep = ':'; /* allow override to colon once */
+ if (*p != sep || csiescseq.narg == ESC_ARG_SIZ)
break;
p++;
}
@@ -1427,6 +1430,12 @@ tsetattr(const int *attr, int l)
case 49:
term.c.attr.bg = defaultbg;
break;
+ case 58:
+ /* This starts a sequence to change the color of
+ * "underline" pixels. We don't support that and
+ * instead eat up a following "5;n" or "2;r;g;b". */
+ tdefcolor(attr, &i, l);
+ break;
default:
if (BETWEEN(attr[i], 30, 37)) {
term.c.attr.fg = attr[i] - 30;
@@ -1643,7 +1652,7 @@ csihandle(void)
ttywrite(vtiden, strlen(vtiden), 0);
break;
case 'b': /* REP -- if last char is printable print it <n> more times */
- DEFAULT(csiescseq.arg[0], 1);
+ LIMIT(csiescseq.arg[0], 1, 65535);
if (term.lastc)
while (csiescseq.arg[0]-- > 0)
tputc(term.lastc);
@@ -1702,7 +1711,7 @@ csihandle(void)
}
break;
case 1: /* above */
- if (term.c.y > 1)
+ if (term.c.y > 0)
tclearregion(0, 0, term.col-1, term.c.y-1);
tclearregion(0, term.c.y, term.c.x, term.c.y);
break;
@@ -1728,6 +1737,7 @@ csihandle(void)
}
break;
case 'S': /* SU -- Scroll <n> line up */
+ if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1);
tscrollup(term.top, csiescseq.arg[0]);
break;
@@ -1797,7 +1807,11 @@ csihandle(void)
tcursor(CURSOR_SAVE);
break;
case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */
- tcursor(CURSOR_LOAD);
+ if (csiescseq.priv) {
+ goto unknown;
+ } else {
+ tcursor(CURSOR_LOAD);
+ }
break;
case ' ':
switch (csiescseq.mode[1]) {
@@ -1953,6 +1967,19 @@ strhandle(void)
tfulldirt();
}
return;
+ case 110:
+ case 111:
+ case 112:
+ if (narg != 1)
+ break;
+ if ((j = par - 110) < 0 || j >= LEN(osc_table))
+ break; /* shouldn't be possible */
+ if (xsetcolorname(osc_table[j].idx, NULL)) {
+ fprintf(stderr, "erresc: %s color not found\n", osc_table[j].str);
+ } else {
+ tfulldirt();
+ }
+ return;
}
break;
case 'k': /* old title set compatibility */
diff --git a/st/st.h b/st/st.h
index 9f91e2a..fd3b0d8 100644
--- a/st/st.h
+++ b/st/st.h
@@ -124,4 +124,3 @@ extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern unsigned int defaultcs;
-extern float alpha;
diff --git a/st/x.c b/st/x.c
index 9c98b8d..e5175c6 100644
--- a/st/x.c
+++ b/st/x.c
@@ -244,7 +244,6 @@ static char *usedfont = NULL;
static double usedfontsize = 0;
static double defaultfontsize = 0;
-static char *opt_alpha = NULL;
static char *opt_class = NULL;
static char **opt_cmd = NULL;
static char *opt_embed = NULL;
@@ -815,9 +814,6 @@ xloadcols(void)
die("could not allocate color %d\n", i);
}
- /* set alpha value of bg color */
- if (opt_alpha)
- alpha = strtof(opt_alpha, NULL);
dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
dc.col[defaultbg].pixel &= 0x00FFFFFF;
dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
@@ -851,6 +847,12 @@ xsetcolorname(int x, const char *name)
XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]);
dc.col[x] = ncolor;
+ if (x == defaultbg) {
+ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
+ dc.col[defaultbg].pixel &= 0x00FFFFFF;
+ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
+ }
+
return 0;
}
@@ -1140,7 +1142,7 @@ xinit(int cols, int rows)
{
XGCValues gcvalues;
Cursor cursor;
- Window parent;
+ Window parent, root;
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
XWindowAttributes attr;
@@ -1150,17 +1152,19 @@ xinit(int cols, int rows)
die("can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
- if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
- parent = XRootWindow(xw.dpy, xw.scr);
- xw.depth = 32;
+ root = XRootWindow(xw.dpy, xw.scr);
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
+ parent = root;
+
+ if (XMatchVisualInfo(xw.dpy, xw.scr, 32, TrueColor, &vis) != 0) {
+ xw.vis = vis.visual;
+ xw.depth = vis.depth;
} else {
XGetWindowAttributes(xw.dpy, parent, &attr);
+ xw.vis = attr.visual;
xw.depth = attr.depth;
}
- XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
- xw.vis = vis.visual;
-
/* font */
if (!FcInit())
die("could not init fontconfig.\n");
@@ -1193,11 +1197,15 @@ xinit(int cols, int rows)
win.w, win.h, 0, xw.depth, InputOutput,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
+ if (parent != root)
+ XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False;
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
- dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
+ dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
+ &gcvalues);
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
+ xw.depth);
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
@@ -1634,6 +1642,9 @@ xseticontitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
+ if (p[0] == '\0')
+ p = opt_title;
+
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop) != Success)
return;
@@ -1648,6 +1659,9 @@ xsettitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
+ if (p[0] == '\0')
+ p = opt_title;
+
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop) != Success)
return;
@@ -2034,11 +2048,11 @@ run(void)
void
usage(void)
{
- die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
+ die("usage: %s [-aiv] [-A alpha] [-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 [-aiv] [-A alpha] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid] -l line"
" [stty_args ...]\n", argv0, argv0);
@@ -2056,7 +2070,8 @@ main(int argc, char *argv[])
allowaltscreen = 0;
break;
case 'A':
- opt_alpha = EARGF(usage());
+ alpha = strtof(EARGF(usage()), NULL);
+ LIMIT(alpha, 0.0, 1.0);
break;
case 'c':
opt_class = EARGF(usage());