更新 st 配置

This commit is contained in:
2022-03-02 00:16:35 +08:00
parent 8a94eb39ab
commit 9781319529
7 changed files with 103 additions and 81 deletions

View File

@@ -76,9 +76,6 @@ app-text/mupdf -opengl
# postgresql
dev-db/postgresql python
# st
x11-terms/st savedconfig
# imagemagick
media-gfx/imagemagick svg xml

View File

@@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h
index 0e01717..e116631 100644
index 91ab8ca..6af616e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -82,6 +82,9 @@ char *termname = "st-256color";
@@ -93,6 +93,9 @@ char *termname = "st-256color";
*/
unsigned int tabspaces = 8;
@@ -12,25 +12,8 @@ index 0e01717..e116631 100644
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
@@ -109,6 +112,7 @@ static const char *colorname[] = {
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#555555",
+ "black",
};
@@ -117,7 +121,7 @@ static const char *colorname[] = {
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 7;
-unsigned int defaultbg = 0;
+unsigned int defaultbg = 258;
static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
diff --git a/config.mk b/config.mk
index 0cbb002..1d2f0e2 100644
index 4c4c5d5..0114bad 100644
--- a/config.mk
+++ b/config.mk
@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
@@ -43,19 +26,19 @@ index 0cbb002..1d2f0e2 100644
`$(PKG_CONFIG) --libs freetype2`
diff --git a/st.h b/st.h
index 38c61c4..b7634ab 100644
index 519b9bd..8bb533d 100644
--- a/st.h
+++ b/st.h
@@ -120,3 +120,4 @@ extern char *termname;
extern unsigned int tabspaces;
@@ -126,3 +126,4 @@ extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern unsigned int defaultcs;
+extern float alpha;
diff --git a/x.c b/x.c
index 0422421..588dec3 100644
index 8a16faa..ddf4178 100644
--- a/x.c
+++ b/x.c
@@ -98,6 +98,7 @@ typedef struct {
@@ -105,6 +105,7 @@ typedef struct {
XSetWindowAttributes attrs;
int scr;
int isfixed; /* is fixed geometry? */
@@ -63,7 +46,7 @@ index 0422421..588dec3 100644
int l, t; /* left and top offset */
int gm; /* geometry mask */
} XWindow;
@@ -229,6 +230,7 @@ static char *usedfont = NULL;
@@ -243,6 +244,7 @@ static char *usedfont = NULL;
static double usedfontsize = 0;
static double defaultfontsize = 0;
@@ -71,7 +54,7 @@ index 0422421..588dec3 100644
static char *opt_class = NULL;
static char **opt_cmd = NULL;
static char *opt_embed = NULL;
@@ -688,7 +690,7 @@ xresize(int col, int row)
@@ -736,7 +738,7 @@ xresize(int col, int row)
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
@@ -80,7 +63,7 @@ index 0422421..588dec3 100644
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h);
@@ -748,6 +750,13 @@ xloadcols(void)
@@ -796,6 +798,13 @@ xloadcols(void)
else
die("could not allocate color %d\n", i);
}
@@ -94,7 +77,7 @@ index 0422421..588dec3 100644
loaded = 1;
}
@@ -1004,11 +1013,23 @@ xinit(int cols, int rows)
@@ -1118,11 +1127,23 @@ xinit(int cols, int rows)
Window parent;
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
@@ -119,7 +102,7 @@ index 0422421..588dec3 100644
/* font */
if (!FcInit())
@@ -1018,7 +1039,7 @@ xinit(int cols, int rows)
@@ -1132,7 +1153,7 @@ xinit(int cols, int rows)
xloadfonts(usedfont, 0);
/* colors */
@@ -128,7 +111,7 @@ index 0422421..588dec3 100644
xloadcols();
/* adjust fixed window geometry */
@@ -1038,19 +1059,15 @@ xinit(int cols, int rows)
@@ -1152,19 +1173,15 @@ xinit(int cols, int rows)
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
xw.attrs.colormap = xw.cmap;
@@ -151,7 +134,7 @@ index 0422421..588dec3 100644
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
@@ -1894,6 +1911,9 @@ main(int argc, char *argv[])
@@ -2019,6 +2036,9 @@ main(int argc, char *argv[])
case 'a':
allowaltscreen = 0;
break;

View File

@@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h
index 0895a1f..eef24df 100644
index 6f05dce..93cbcc0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -188,6 +188,8 @@ static Shortcut shortcuts[] = {
@@ -199,6 +199,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
@@ -12,7 +12,7 @@ index 0895a1f..eef24df 100644
/*
diff --git a/st.c b/st.c
index 0ce6ac2..641edc0 100644
index ebdf360..817cc47 100644
--- a/st.c
+++ b/st.c
@@ -35,6 +35,7 @@
@@ -33,7 +33,7 @@ index 0ce6ac2..641edc0 100644
enum term_mode {
MODE_WRAP = 1 << 0,
@@ -117,6 +121,9 @@ typedef struct {
@@ -115,6 +119,9 @@ typedef struct {
int col; /* nb col */
Line *line; /* screen */
Line *alt; /* alternate screen */
@@ -43,7 +43,7 @@ index 0ce6ac2..641edc0 100644
int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */
int ocx; /* old cursor col */
@@ -185,8 +192,8 @@ static void tnewline(int);
@@ -184,8 +191,8 @@ static void tnewline(int);
static void tputtab(int);
static void tputc(Rune);
static void treset(void);
@@ -51,10 +51,10 @@ index 0ce6ac2..641edc0 100644
-static void tscrolldown(int, int);
+static void tscrollup(int, int, int);
+static void tscrolldown(int, int, int);
static void tsetattr(int *, int);
static void tsetchar(Rune, Glyph *, int, int);
static void tsetattr(const int *, int);
static void tsetchar(Rune, const Glyph *, int, int);
static void tsetdirt(int, int);
@@ -415,10 +422,10 @@ tlinelen(int y)
@@ -416,10 +423,10 @@ tlinelen(int y)
{
int i = term.col;
@@ -67,7 +67,7 @@ index 0ce6ac2..641edc0 100644
--i;
return i;
@@ -527,7 +534,7 @@ selsnap(int *x, int *y, int direction)
@@ -528,7 +535,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or
* beginning of a line.
*/
@@ -76,7 +76,7 @@ index 0ce6ac2..641edc0 100644
prevdelim = ISDELIM(prevgp->u);
for (;;) {
newx = *x + direction;
@@ -542,14 +549,14 @@ selsnap(int *x, int *y, int direction)
@@ -543,14 +550,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x;
else
yt = newy, xt = newx;
@@ -93,7 +93,7 @@ index 0ce6ac2..641edc0 100644
delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u)))
@@ -570,14 +577,14 @@ selsnap(int *x, int *y, int direction)
@@ -571,14 +578,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) {
for (; *y > 0; *y += direction) {
@@ -110,7 +110,7 @@ index 0ce6ac2..641edc0 100644
& ATTR_WRAP)) {
break;
}
@@ -608,13 +615,13 @@ getsel(void)
@@ -609,13 +616,13 @@ getsel(void)
}
if (sel.type == SEL_RECTANGULAR) {
@@ -127,7 +127,7 @@ index 0ce6ac2..641edc0 100644
while (last >= gp && last->u == ' ')
--last;
@@ -849,6 +856,9 @@ void
@@ -850,6 +857,9 @@ void
ttywrite(const char *s, size_t n, int may_echo)
{
const char *next;
@@ -137,7 +137,7 @@ index 0ce6ac2..641edc0 100644
if (may_echo && IS_SET(MODE_ECHO))
twrite(s, n, 1);
@@ -1060,13 +1070,53 @@ tswapscreen(void)
@@ -1061,13 +1071,53 @@ tswapscreen(void)
}
void
@@ -192,7 +192,7 @@ index 0ce6ac2..641edc0 100644
tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1076,17 +1126,28 @@ tscrolldown(int orig, int n)
@@ -1077,17 +1127,28 @@ tscrolldown(int orig, int n)
term.line[i-n] = temp;
}
@@ -223,7 +223,7 @@ index 0ce6ac2..641edc0 100644
tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot);
@@ -1096,7 +1157,8 @@ tscrollup(int orig, int n)
@@ -1097,7 +1158,8 @@ tscrollup(int orig, int n)
term.line[i+n] = temp;
}
@@ -233,7 +233,7 @@ index 0ce6ac2..641edc0 100644
}
void
@@ -1135,7 +1197,7 @@ tnewline(int first_col)
@@ -1126,7 +1188,7 @@ tnewline(int first_col)
int y = term.c.y;
if (y == term.bot) {
@@ -242,7 +242,7 @@ index 0ce6ac2..641edc0 100644
} else {
y++;
}
@@ -1300,14 +1362,14 @@ void
@@ -1291,14 +1353,14 @@ void
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
@@ -259,7 +259,7 @@ index 0ce6ac2..641edc0 100644
}
int32_t
@@ -1738,11 +1800,11 @@ csihandle(void)
@@ -1735,11 +1797,11 @@ csihandle(void)
break;
case 'S': /* SU -- Scroll <n> line up */
DEFAULT(csiescseq.arg[0], 1);
@@ -273,7 +273,7 @@ index 0ce6ac2..641edc0 100644
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
@@ -2248,7 +2310,7 @@ eschandle(uchar ascii)
@@ -2251,7 +2313,7 @@ eschandle(uchar ascii)
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
@@ -282,7 +282,7 @@ index 0ce6ac2..641edc0 100644
} else {
tmoveto(term.c.x, term.c.y+1);
}
@@ -2261,7 +2323,7 @@ eschandle(uchar ascii)
@@ -2264,7 +2326,7 @@ eschandle(uchar ascii)
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
@@ -291,7 +291,7 @@ index 0ce6ac2..641edc0 100644
} else {
tmoveto(term.c.x, term.c.y-1);
}
@@ -2482,7 +2544,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
@@ -2474,7 +2536,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void
tresize(int col, int row)
{
@@ -300,7 +300,7 @@ index 0ce6ac2..641edc0 100644
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
@@ -2519,6 +2581,14 @@ tresize(int col, int row)
@@ -2511,6 +2573,14 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
@@ -315,7 +315,7 @@ index 0ce6ac2..641edc0 100644
/* resize each row to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
@@ -2577,7 +2647,7 @@ drawregion(int x1, int y1, int x2, int y2)
@@ -2569,7 +2639,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0;
@@ -324,7 +324,7 @@ index 0ce6ac2..641edc0 100644
}
}
@@ -2598,8 +2668,9 @@ draw(void)
@@ -2590,8 +2660,9 @@ draw(void)
cx--;
drawregion(0, 0, term.col, term.row);
@@ -337,7 +337,7 @@ index 0ce6ac2..641edc0 100644
term.ocy = term.c.y;
xfinishdraw();
diff --git a/st.h b/st.h
index d978458..b9a4eeb 100644
index fa2eddf..adda2db 100644
--- a/st.h
+++ b/st.h
@@ -81,6 +81,8 @@ void die(const char *, ...);

View File

@@ -1,13 +1,25 @@
From b5d3351a21442a842e01e8c0317603b6890b379c Mon Sep 17 00:00:00 2001
From: asparagii <michele.lambertucci1@gmail.com>
Date: Thu, 27 Jan 2022 15:44:02 +0100
Subject: [PATCH] st-scrollback-mouse
---
config.def.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/config.def.h b/config.def.h
index ec1b576..4b3bf15 100644
index e3b469b..c217315 100644
--- a/config.def.h
+++ b/config.def.h
@@ -163,6 +163,8 @@ static uint forcemousemod = ShiftMask;
@@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask;
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
+ { ShiftMask, Button4, kscrollup, {.i = 1} },
+ { ShiftMask, Button5, kscrolldown, {.i = 1} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
--
2.34.1

View File

@@ -1,23 +1,35 @@
From 580e3f386e9215707100e9ba44797701943fd927 Mon Sep 17 00:00:00 2001
From: asparagii <michele.lambertucci1@gmail.com>
Date: Thu, 27 Jan 2022 15:49:27 +0100
Subject: [PATCH] st-scrollback-mouse-altscreen
---
config.def.h | 4 ++--
st.c | 5 +++++
st.h | 1 +
x.c | 2 ++
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 4b3bf15..1986316 100644
index c217315..c223706 100644
--- a/config.def.h
+++ b/config.def.h
@@ -163,8 +163,8 @@ static uint forcemousemod = ShiftMask;
@@ -176,8 +176,8 @@ static uint forcemousemod = ShiftMask;
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
- { ShiftMask, Button4, kscrollup, {.i = 1} },
- { ShiftMask, Button5, kscrolldown, {.i = 1} },
+ { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 },
+ { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 },
+ { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 },
+ { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
diff --git a/st.c b/st.c
index f8b6f67..dd4cb31 100644
--- st.c
+++ st.c
@@ -1045,6 +1045,11 @@ tnew(int col, int row)
index f3af82b..876a6bf 100644
--- a/st.c
+++ b/st.c
@@ -1060,6 +1060,11 @@ tnew(int col, int row)
treset();
}
@@ -30,9 +42,9 @@ index f8b6f67..dd4cb31 100644
tswapscreen(void)
{
diff --git a/st.h b/st.h
index 1332cf1..f9ad815 100644
--- st.h
+++ st.h
index da36b34..e95c6f8 100644
--- a/st.h
+++ b/st.h
@@ -89,6 +89,7 @@ void sendbreak(const Arg *);
void toggleprinter(const Arg *);
@@ -42,9 +54,9 @@ index 1332cf1..f9ad815 100644
void tresize(int, int);
void tsetdirtattr(int);
diff --git a/x.c b/x.c
index e5f1737..b8fbd7b 100644
--- x.c
+++ x.c
index cd96575..9274556 100644
--- a/x.c
+++ b/x.c
@@ -34,6 +34,7 @@ typedef struct {
void (*func)(const Arg *);
const Arg arg;
@@ -53,7 +65,7 @@ index e5f1737..b8fbd7b 100644
} MouseShortcut;
typedef struct {
@@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release)
@@ -455,6 +456,7 @@ mouseaction(XEvent *e, uint release)
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (ms->release == release &&
ms->button == e->xbutton.button &&
@@ -61,3 +73,6 @@ index e5f1737..b8fbd7b 100644
(match(ms->mod, state) || /* exact or forced */
match(ms->mod, state & ~forcemousemod))) {
ms->func(&(ms->arg));
--
2.34.1