Compare commits

..

38 commits

Author SHA1 Message Date
ant
b5498bad11 Revert "change colors for light theme"
This reverts commit 042af42400.
2025-11-30 15:20:10 +01:00
Antoine Vaure
33209c6746 change colors for light theme 2025-11-30 15:20:10 +01:00
Antoine Vaure
f8b47f894b add keybinnds to scroll 2025-11-30 15:19:37 +01:00
Antoine Vaure
ae3a9baf0d decrease default font size 2025-11-30 15:17:58 +01:00
ant
1cc56c4856 Enable alpha patch 2025-11-30 15:17:58 +01:00
ant
a9d0d20213 enable boxdraw 2025-11-30 15:17:58 +01:00
ant
7415d93cf2 Add a nix flake 2025-11-30 15:17:58 +01:00
ant
d0b32e19c6 enable patches I want 2025-11-30 15:17:58 +01:00
ant
1ea9ec607b change keys to keyboard select and zoom 2025-11-30 15:17:58 +01:00
ant
84a920d545 change default colors 2025-11-30 15:17:58 +01:00
ant
48defe07d2 Add darkman patch
a patch to choose between two color themes by executing a command
2025-11-30 15:17:58 +01:00
ant
d44ab2a9a2 font default to caskadia 2025-11-30 15:17:58 +01:00
Antoine Vaure
b8131450b0 config: increase scroll speed 2025-11-30 15:17:58 +01:00
ant
ec1b8b0ac0 fontfeature patch 2025-11-30 15:17:58 +01:00
Javier
37bc089f1d Add selectionbg-alpha patch (#188) 2025-10-28 10:18:15 +01:00
Bakkeby
e77d5e1b3b sync patch: add DECRQM 80 and 8452 for sixel patch ref. #179 2025-10-26 00:22:53 +02:00
Bakkeby
d12d2ad1c2 sync patch: remove redundant inner #if for DECRQM -- DEC Request Mode case statement ref. #179 2025-10-25 14:04:52 +02:00
Bakkeby
46a5982e9d Removing utils.h, leftover from the vim browse patch 2025-10-14 16:03:38 +02:00
Lady Alice
1d5c8a1595
reflow: enable keyboard scrolling by default (#187) 2025-10-14 14:26:45 +02:00
Bakkeby
bdb21ddb8b bump version to 0.9.3
https://git.suckless.org/st/commit/5a4666c19e3956069147aee43a06b326d998366e.html

add a few comments

https://git.suckless.org/st/commit/5a4666c19e3956069147aee43a06b326d998366e.html

Support OSC 110, 111, and 112 for resetting colors

This adds support for OSC 110, 111, and 112 escape sequences to reset
the foreground, background, and cursor colors in the terminal. The
changes include handling these sequences in the `strhandle` function of
`st.c`, allowing applications to reset colors to their default values.

The OSC sequences originated from Xterm control sequences and are now
widely used in terminal applications and supported by many terminal
emulators. For applications, this allows them to reset colors to
default values without needing to know the colors beforehand.

https://git.suckless.org/st/commit/d6c431859c6c0201e0668ed24a9f17cebf0a68f5.html
2025-08-10 15:44:48 +02:00
Bakkeby
9328548866 xresources: removing focus change ttywrite ref. #182 2025-08-03 22:19:37 +02:00
Bakkeby
92e6c003f7 Eat up "CSI 58" sequences
This is used in the wild by systemd systemctl for example and st
misinterpreted it as "blink", because it didn't know "58", then saw "5"
as "blink", and then didn't know "245".

This should print "foo" as normal text:

    printf '\e[58:5:245mfoo\n'
    printf '\e[58:2:50💯200mfoo\n'

Ref.
https://git.suckless.org/st/commit/f114bcedd113017d907aad32031db92c050f4bf3.html
2025-07-27 20:48:20 +02:00
Bakkeby
fba8d10417 Bump to 98610fc 2025-07-09 09:47:04 +02:00
Laurent Cheylus
f17e1dcf31
Do not interpret CSI ? u as DECRC (#181)
The kitty keyboard protocol docs recommend CSI ? u to query support for
that protocol, see https://sw.kovidgoyal.net/kitty/keyboard-protocol/

For better or worse, fish shell uses this query to work around bugs
in other terminals triggered by requesting that protocol via CSI = 5 u.

Unfortunately, st interprets CSI ? u as DECRC (restore cursor
position). reproduce with 'printf "\x1b[?u"; cat'.

fish could work around this by switching to the alternate screen
before running this query; but that might cause tearing on terminals
that don't support Synchronized Output. I'm not sure.

In the meantime, let's correct our parser.

This adds a redundant else-after-return, for consistency with the
surrounding code.

ref. https://git.suckless.org/st/commit/98610fcd37f655d44586323dc86c1d013c2798ce.html

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2025-07-09 09:45:24 +02:00
Bakkeby
7c28c7868a sync: add support for DECRQM queries for synchronization ref. #179 2025-07-08 19:17:57 +02:00
Bakkeby
9edaa4c149 sync: mode 2026 correction ref. #179 2025-07-08 15:11:17 +02:00
Bakkeby
4000b47a10 sync: adding mode 2026 for the sync patch to allow syncing to be controlled by programs ref. #179 2025-07-08 10:42:24 +02:00
Bakkeby
dd9784883f boxdraw: fix for rendering errors following commit f8e451e ref. #180 2025-07-08 10:27:50 +02:00
Bakkeby
43d9be991b OpenBSD compatibility changes 2025-06-16 22:53:48 +02:00
Bakkeby
f8e451e26c Refactoring Xft clipping ref. #175 2025-05-06 14:41:20 +02:00
veltza
cb91e175ba
Prevent SelectionRequests from interfering with blinking cursor (#173)
Some old clipboard managers, such as greenclip and parcellite,
constantly poll applications with SelectionRequest events, which breaks
the internal timer and blinking cursor. This fix prevents these events
from causing any disruption.

Fixes #172
2025-04-22 09:53:53 +02:00
Bakkeby
da81ae1704 dynamic padding - add explicit dependency on the ANYSIZE_PATCH ref. #168 2025-03-04 10:12:43 +01:00
Bakkeby
dc64384989 dynamic cursor color: visual bug on selection ref. #169 2025-02-27 21:57:48 +01:00
Bakkeby
d60f1b355f Adding dynamic padding patch - a variant of anysize that do not alter size hints ref. #168 2025-02-26 22:36:24 +01:00
Bakkeby
75da349fb3 selection colors vs dynamic cursor color patch compatibility issue ref. #167 2025-02-26 21:58:05 +01:00
Bakkeby
c4af76a9cc reflow: addressing selection clearing bug when selection includes the prompt ref. #166 2025-02-26 21:23:09 +01:00
Bakkeby
978e25f23b Adding open selected text patch 2025-02-20 22:36:51 +01:00
Bakkeby
08b53c4960 Adding drag-n-drop patch 2025-02-20 10:18:17 +01:00
8 changed files with 97 additions and 63 deletions

View file

@ -1,4 +1,4 @@
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.9.2 (98610fc, 2025-01-26) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.9.3 (6e97047, 2025-08-09) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.def.h):
```c
@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog:
2025-10-28 - Added the selectionbg-alpha patch
2025-02-20 - Added the drag-n-drop and open-selected-text patches
2024-05-31 - Added the anygeometry patch
@ -260,6 +262,10 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [right-click-to-plumb](https://st.suckless.org/patches/right_click_to_plumb/)
- allows you to right-click on some selected text to send it to the plumbing program of choice
- [selectionbg-alpha](https://st.suckless.org/patches/selectionbg-alpha/)
- allows for the selection to have a transparent background when combined with the alpha
and selection colors patches
- [scrollback](https://st.suckless.org/patches/scrollback/)
- allows you scroll back through terminal output using keyboard shortcuts or mousewheel

View file

@ -162,7 +162,7 @@ unsigned int tabspaces = 8;
#if ALPHA_PATCH
/* bg opacity */
float alpha = 0.9;
float alpha = 0.8;
#if ALPHA_GRADIENT_PATCH
float grad_alpha = 0.54; //alpha value that'll change
float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha
@ -183,28 +183,28 @@ char *xdndescchar = " !\"#$&'()*;<>?[\\]^`{|}~";
/* Terminal colors (16 first used in escape sequence) */
static char *colorname[] = {
"#000000",
"#ff3333",
"#86b200",
"#f19618",
"#41a6d9",
"#f07078",
"#4cbe99",
"#ffffff",
"#323232",
"#ff6565",
"#b8e532",
"#ffc849",
"#73d7ff",
"#ffa3aa",
"#7ff0cb",
"#ffffff",
"#011627", /* hard contrast: #1d2021 / soft contrast: #32302f */
"#d3423e",
"#2aa298",
"#daaa01",
"#4876d6",
"#403f53",
"#08916a",
"#7a8181",
"#7a8181",
"#f76e6e",
"#49d0c5",
"#dac26b",
"#5ca7e4",
"#697098",
"#00c990",
"#989fb1",
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#403f53", /* 256 -> cursor */
"#f0ede4", /* 257 -> rev cursor*/
"#fafafa", /* 258 -> bg */
"#5b6673", /* 259 -> fg */
"#f2f2f2", /* 257 -> rev cursor*/
"#ffffff", /* 258 -> bg */
"#403f53", /* 259 -> fg */
};
#if DARKMAN_PATCH
@ -469,14 +469,14 @@ static Shortcut shortcuts[] = {
{ XK_NO_MOD, XK_F11, fullscreen, {.i = 0} },
{ MODKEY, XK_Return, fullscreen, {.i = 0} },
#endif // FULLSCREEN_PATCH
#if SCROLLBACK_PATCH
#if SCROLLBACK_PATCH || REFLOW_PATCH
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1}, S_PRI },
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}, S_PRI },
{ TERMMOD, XK_U, kscrollup, {.i = -1}, S_PRI },
{ TERMMOD, XK_D, kscrolldown, {.i = -1}, S_PRI },
{ TERMMOD, XK_K, kscrollup, {.i = 4}, S_PRI },
{ TERMMOD, XK_J, kscrolldown, {.i = 4}, S_PRI },
#endif // SCROLLBACK_PATCH
#endif // SCROLLBACK_PATCH || REFLOW_PATCH
#if CLIPBOARD_PATCH
{ TERMMOD, XK_Y, clippaste, {.i = 0} },
{ ShiftMask, XK_Insert, clippaste, {.i = 0} },

View file

@ -1,5 +1,5 @@
# st version
VERSION = 0.9.2
VERSION = 0.9.3
# Customize below to fit your system

View file

@ -1,23 +0,0 @@
/// Dynamic memory-chunk, with (1) datatype size, (2/3) initialized / allocated chunk, (4) content
typedef struct { uint8_t const elSize; uint32_t init, alloc; char* content; } DynamicArray;
#define UTF8_ARRAY {4, 0, 0, NULL}
static inline int p_alloc(DynamicArray *s, uint32_t amount) {
uint32_t const diff=s->init+s->elSize*amount-s->alloc, nas=s->alloc+max(diff,15)*s->elSize;
if (s->alloc < s->init + s->elSize * amount) {
char* tmp = realloc(s->content, nas);
if (!tmp) return 0;
s->alloc = nas, s->content = tmp;
}
return 1;
}
static inline char *view(DynamicArray * s, uint32_t i) { return s->content + i*s->elSize; }
static inline char *end(DynamicArray *s, uint32_t i) { return s->content +s->init-(i+1)*s->elSize; }
static inline uint32_t getU32(DynamicArray* s, uint32_t i, int b) { return *((uint32_t*) (b ?view(s,i) :end(s,i))); }
static char *expand(DynamicArray *s) { if (!p_alloc(s, 1)) return NULL; s->init += s->elSize; return end(s, 0); }
static inline void pop(DynamicArray* s) { s->init -= s->elSize; }
static inline void empty(DynamicArray* s) { s->init = 0; }
static inline int size(DynamicArray const * s) { return s->init / s->elSize; }
static inline void assign(DynamicArray* s, DynamicArray const *o) {
if (p_alloc(s, size(o))) memcpy(s->content, o->content, (s->init=o->init));
}

View file

@ -74,9 +74,5 @@ reload_config(int sig)
xhints();
XCloseDisplay(dpy);
/* from https://st.suckless.org/patches/xresources-with-reload-signal */
/* triggers re-render if we're visible */
ttywrite("\033[O", 3, 1);
}
#endif // XRESOURCES_RELOAD_PATCH

View file

@ -387,6 +387,12 @@
*/
#define SELECTION_COLORS_PATCH 0
/* This patch works with selectioncolors and alpha patches to make selection
* background color transparent.
* https://st.suckless.org/patches/selectionbg-alpha/
*/
#define SELECTIONBG_ALPHA_PATCH 0
/* This is the single drawable buffer patch as outlined in the FAQ to get images
* in w3m to display. While this patch does not break the alpha patch it images
* are not shown in w3m if the alpha patch is applied.

56
st.c
View file

@ -1837,7 +1837,7 @@ tsetattr(const int *attr, int l)
term.c.attr.fg = idx;
#endif // MONOCHROME_PATCH
break;
case 39:
case 39: /* set foreground color to default */
term.c.attr.fg = defaultfg;
break;
case 48:
@ -1848,7 +1848,7 @@ tsetattr(const int *attr, int l)
term.c.attr.bg = idx;
#endif // MONOCHROME_PATCH
break;
case 49:
case 49: /* set background color to default */
term.c.attr.bg = defaultbg;
break;
#if UNDERCURL_PATCH
@ -1864,6 +1864,13 @@ tsetattr(const int *attr, int l)
term.c.attr.ucolor[2] = -1;
term.c.attr.mode ^= ATTR_DIRTYUNDERLINE;
break;
#else
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;
#endif // UNDERCURL_PATCH
default:
if (BETWEEN(attr[i], 30, 37)) {
@ -1978,7 +1985,7 @@ tsetmode(int priv, int set, const int *args, int narg)
case 1006: /* 1006: extended reporting mode */
xsetmode(set, MODE_MOUSESGR);
break;
case 1034:
case 1034: /* 1034: enable 8-bit mode for keyboard input */
xsetmode(set, MODE_8BIT);
break;
case 1049: /* swap screen & set/restore cursor as xterm */
@ -1986,8 +1993,8 @@ tsetmode(int priv, int set, const int *args, int narg)
break;
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
/* FALLTHROUGH */
case 47: /* swap screen */
case 1047:
case 47: /* swap screen buffer */
case 1047: /* swap screen buffer */
if (!allowaltscreen)
break;
#if REFLOW_PATCH
@ -2011,7 +2018,7 @@ tsetmode(int priv, int set, const int *args, int narg)
break;
/* FALLTHROUGH */
#endif // REFLOW_PATCH
case 1048:
case 1048: /* save/restore cursor (like DECSC/DECRC) */
#if REFLOW_PATCH
if (!allowaltscreen)
break;
@ -2444,10 +2451,22 @@ csihandle(void)
goto unknown;
}
break;
#if SYNC_PATCH
#if SYNC_PATCH || SIXEL_PATCH
case '$': /* DECRQM -- DEC Request Mode (private) */
if (csiescseq.mode[1] == 'p' && csiescseq.priv) {
switch (csiescseq.arg[0]) {
#if SIXEL_PATCH
case 80:
/* Sixel Display Mode */
ttywrite(IS_SET(MODE_SIXEL_SDM) ? "\033[?80;1$y"
: "\033[?80;2$y", 9, 0);
break;
case 8452:
/* Sixel scrolling leaves cursor to right of graphic */
ttywrite(IS_SET(MODE_SIXEL_CUR_RT) ? "\033[?8452;1$y"
: "\033[?8452;2$y", 11, 0);
break;
#endif // SIXEL_PATCH
#if SYNC_PATCH
case 2026:
/* https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036 */
@ -2460,7 +2479,7 @@ csihandle(void)
break;
}
goto unknown;
#endif // SYNC_PATCH
#endif // SYNC_PATCH | SIXEL_PATCH
case 'r': /* DECSTBM -- Set Scrolling Region */
if (csiescseq.priv) {
goto unknown;
@ -2649,7 +2668,7 @@ strhandle(void)
xsettitle(strescseq.args[1]);
#endif // CSI_22_23_PATCH
return;
case 52:
case 52: /* manipulate selection data */
if (narg > 2 && allowwindowops) {
dec = base64dec(strescseq.args[2]);
if (dec) {
@ -2667,9 +2686,9 @@ strhandle(void)
#endif // OSC7_PATCH
case 8: /* Clear Hyperlinks */
return;
case 10:
case 11:
case 12:
case 10: /* set dynamic VT100 text foreground color */
case 11: /* set dynamic VT100 text background color */
case 12: /* set dynamic text cursor color */
if (narg < 2)
break;
p = strescseq.args[1];
@ -2710,6 +2729,19 @@ strhandle(void)
tfulldirt();
}
return;
case 110: /* reset dynamic VT100 text foreground color */
case 111: /* reset dynamic VT100 text background color */
case 112: /* reset dynamic text cursor color */
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;
#if OSC133_PATCH
case 133:
if (narg < 2)

17
x.c
View file

@ -983,6 +983,11 @@ xloadalpha(void)
dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * usedAlpha);
dc.col[defaultbg].pixel &= 0x00FFFFFF;
dc.col[defaultbg].pixel |= (unsigned char)(0xff * usedAlpha) << 24;
#if SELECTION_COLORS_PATCH && SELECTIONBG_ALPHA_PATCH
dc.col[selectionbg].color.alpha = (unsigned short)(0xffff * usedAlpha);
dc.col[selectionbg].pixel &= 0x00FFFFFF;
dc.col[selectionbg].pixel |= (unsigned char)(0xff * usedAlpha) << 24;
#endif // SELECTION_COLORS_PATCH && SELECTIONBG_ALPHA_PATCH
}
#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH
@ -1068,6 +1073,18 @@ xloadcols(void)
dc.col[defaultbg].color.red *= alpha;
dc.col[defaultbg].color.green *= alpha;
dc.col[defaultbg].color.blue *= alpha;
#if SELECTION_COLORS_PATCH && SELECTIONBG_ALPHA_PATCH
/* set alpha value of selbg color */
dc.col[selectionbg].color.alpha = (unsigned short)(0xffff * alpha);
dc.col[selectionbg].pixel &= 0x00FFFFFF;
dc.col[selectionbg].pixel |= (unsigned char)(0xff * alpha) << 24;
dc.col[selectionbg].color.red =
((unsigned short)(dc.col[selectionbg].color.red * alpha)) & 0xff00;
dc.col[selectionbg].color.green =
((unsigned short)(dc.col[selectionbg].color.green * alpha)) & 0xff00;
dc.col[selectionbg].color.blue =
((unsigned short)(dc.col[selectionbg].color.blue * alpha)) & 0xff00;
#endif // SELECTION_COLORS_PATCH && SELECTIONBG_ALPHA_PATCH
#endif // ALPHA_PATCH
loaded = 1;
}