Compare commits
38 commits
042af42400
...
b5498bad11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5498bad11 | ||
|
|
33209c6746 | ||
|
|
f8b47f894b | ||
|
|
ae3a9baf0d | ||
|
|
1cc56c4856 | ||
|
|
a9d0d20213 | ||
|
|
7415d93cf2 | ||
|
|
d0b32e19c6 | ||
|
|
1ea9ec607b | ||
|
|
84a920d545 | ||
|
|
48defe07d2 | ||
|
|
d44ab2a9a2 | ||
|
|
b8131450b0 | ||
|
|
ec1b8b0ac0 | ||
|
|
37bc089f1d | ||
|
|
e77d5e1b3b | ||
|
|
d12d2ad1c2 | ||
|
|
46a5982e9d | ||
|
|
1d5c8a1595 | ||
|
|
bdb21ddb8b | ||
|
|
9328548866 | ||
|
|
92e6c003f7 | ||
|
|
fba8d10417 | ||
|
|
f17e1dcf31 | ||
|
|
7c28c7868a | ||
|
|
9edaa4c149 | ||
|
|
4000b47a10 | ||
|
|
dd9784883f | ||
|
|
43d9be991b | ||
|
|
f8e451e26c | ||
|
|
cb91e175ba | ||
|
|
da81ae1704 | ||
|
|
dc64384989 | ||
|
|
d60f1b355f | ||
|
|
75da349fb3 | ||
|
|
c4af76a9cc | ||
|
|
978e25f23b | ||
|
|
08b53c4960 |
8 changed files with 97 additions and 63 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
44
config.def.h
44
config.def.h
|
|
@ -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} },
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# st version
|
||||
VERSION = 0.9.2
|
||||
VERSION = 0.9.3
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
56
st.c
|
|
@ -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
17
x.c
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue