From 7faa6813ef55b130d1f6b2e6483bd8a4614178a7 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 18 Apr 2024 13:50:18 +0200 Subject: [PATCH] fixes --- Makefile | 4 +- config.h | 75 ++++++++++++++++++++++---------------- config.mk | 18 ++++++--- patches.h | 2 +- patches/font-features.diff | 2 +- 5 files changed, 60 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 307a983..d0e4488 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,8 @@ install: st chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 mkdir -p $(DESTDIR)$(PREFIX)/share/terminfo tic -sx -o $(DESTDIR)$(PREFIX)/share/terminfo st.info - # mkdir -p $(DESTDIR)$(PREFIX)/share/applications # desktop-entry patch - # test -f ${DESTDIR}${PREFIX}/share/applications/st.desktop || cp -n st.desktop $(DESTDIR)$(PREFIX)/share/applications # desktop-entry patch + mkdir -p $(DESTDIR)$(PREFIX)/share/applications # desktop-entry patch + test -f ${DESTDIR}${PREFIX}/share/applications/st.desktop || cp -n st.desktop $(DESTDIR)$(PREFIX)/share/applications # desktop-entry patch @echo Please see the README file regarding the terminfo entry of st. uninstall: diff --git a/config.h b/config.h index 9f8f08d..9058aef 100644 --- a/config.h +++ b/config.h @@ -32,7 +32,10 @@ char *scroll = NULL; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; /* identification sequence returned in DA and DECID */ -char *vtiden = "\033[?12;4c"; +char *vtiden = "\033[?62;4c"; /* VT200 family (62) with sixel (4) */ + +/* sixel rgb byte order: LSBFirst or MSBFirst */ +int const sixelbyteorder = LSBFirst; /* Kerning / character bounding-box multipliers */ static float cwscale = 1.0; @@ -45,6 +48,10 @@ static float chscale = 1.0; */ wchar_t *worddelimiters = L" `'\"()[]{}=,"; +/* Word delimiters for short and long jumps in the keyboard select patch */ +wchar_t *kbds_sdelim = L"!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~ "; +wchar_t *kbds_ldelim = L" "; + /* selection timeouts (in milliseconds) */ static unsigned int doubleclicktimeout = 300; static unsigned int tripleclicktimeout = 600; @@ -62,8 +69,8 @@ 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 = 5; -static double maxlatency = 30; +static double minlatency = 2; +static double maxlatency = 33; /* * Synchronized-Update timeout in ms @@ -82,6 +89,9 @@ static unsigned int blinktimeout = 800; */ static unsigned int cursorthickness = 2; +/* Hide the X cursor whenever a key is pressed. 0: off, 1: on */ +int hidecursor = 1; + /* * 1: render most of the lines/blocks characters without using the font for * perfect alignment between cells (U2500 - U259F except dashes/diagonals). @@ -155,13 +165,19 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -unsigned int defaultcs = 256; -unsigned int defaultrcs = 257; unsigned int defaultfg = 258; unsigned int defaultbg = 259; +unsigned int defaultcs = 256; +unsigned int defaultrcs = 257; unsigned int selectionfg = 260; unsigned int selectionbg = 261; -static int ignoreselfg = 259; +/* If 0 use selectionfg as foreground in order to have a uniform + * foreground-color */ +/* Else if 1 keep original foreground-color of each cell => more colors :) */ +static int ignoreselfg = 1; +/* Foreground and background color of search results */ +unsigned int highlightfg = 3; +unsigned int highlightbg = 0; /* * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81 @@ -187,9 +203,11 @@ static unsigned int cols = 80; static unsigned int rows = 24; /* - * Default shape of the mouse cursor + * Default colour and shape of the mouse cursor */ -static char *mouseshape = "xterm"; +static unsigned int mouseshape = XC_xterm; +static unsigned int mousefg = 7; +static unsigned int mousebg = 0; /* * Color used to display font attributes when fontconfig selected a font which @@ -211,13 +229,8 @@ static uint forcemousemod = ShiftMask; static MouseShortcut mshortcuts[] = { /* mask button function argument release screen */ - { ShiftMask, Button4, kscrollup, {.i = 1}, 0, S_PRI}, - { ShiftMask, Button5, kscrolldown, {.i = 1}, 0, S_PRI}, - // { XK_ANY_MOD, Button2, clippaste, {.i = 0}, 1 }, - // { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, - // { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, - // { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, - // { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, + {ShiftMask, Button4, kscrollup, {.i = 1}, 0, S_PRI}, + {ShiftMask, Button5, kscrolldown, {.i = 1}, 0, S_PRI}, }; /* Internal keyboard shortcuts. */ @@ -232,22 +245,22 @@ static char *setbgcolorcmd[] = {"/bin/sh", "-c", "printf '\033]11;#008000\007'", "externalpipein", NULL}; static Shortcut shortcuts[] = { - /* mask keysym function argument screen - */ - { XK_ANY_MOD, XK_Break, sendbreak, {.i = 0}}, - { ControlMask, XK_Print, toggleprinter, {.i = 0}}, - { ShiftMask, XK_Print, printscreen, {.i = 0}}, - { XK_ANY_MOD, XK_Print, printsel, {.i = 0}}, - { TERMMOD, XK_Prior, zoom, {.f = +3}}, - { TERMMOD, XK_Next, zoom, {.f = -3}}, - { TERMMOD, XK_Home, zoomreset, {.f = 0}}, - { TERMMOD, XK_C, clipcopy, {.i = 0}}, - { TERMMOD, XK_V, clippaste, {.i = 0}}, - { TERMMOD, XK_Y, selpaste, {.i = 0}}, - { TERMMOD, XK_Num_Lock, numlock, {.i = 0}}, - { TERMMOD, XK_Escape, keyboard_select, {0}}, - { TERMMOD, XK_K, kscrollup, {.i = 20}, S_PRI }, - { TERMMOD, XK_J, kscrolldown, {.i = 20}, S_PRI }, + {XK_ANY_MOD, XK_Break, sendbreak, {.i = 0}}, + {ControlMask, XK_Print, toggleprinter, {.i = 0}}, + {TERMMOD, XK_Print, printscreen, {.i = 0}}, + {XK_ANY_MOD, XK_Print, printsel, {.i = 0}}, + {TERMMOD, XK_Prior, zoom, {.f = +3}}, + {TERMMOD, XK_Next, zoom, {.f = -3}}, + {TERMMOD, XK_Home, zoomreset, {.f = 0}}, + {TERMMOD, XK_C, clipcopy, {.i = 0}}, + {TERMMOD, XK_V, clippaste, {.i = 0}}, + {TERMMOD, XK_Y, selpaste, {.i = 0}}, + {TERMMOD, XK_K, kscrollup, {.i = 20}, S_PRI}, + {TERMMOD, XK_J, kscrolldown, {.i = 20}, S_PRI}, + {TERMMOD, XK_Num_Lock, numlock, {.i = 0}}, + {TERMMOD, XK_Escape, keyboard_select, {0}}, + {TERMMOD, XK_F, searchforward, {0}}, + {TERMMOD, XK_B, searchbackward, {0}}, }; /* diff --git a/config.mk b/config.mk index db1f56f..ea3a8b2 100644 --- a/config.mk +++ b/config.mk @@ -1,11 +1,13 @@ # st version -VERSION = 0.9 +VERSION = 0.9.1 # Customize below to fit your system # paths PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man +ICONPREFIX = $(PREFIX)/share/pixmaps +ICONNAME = st.png X11INC = /usr/include/X11 X11LIB = /usr/lib @@ -13,10 +15,10 @@ X11LIB = /usr/lib PKG_CONFIG = pkg-config # Uncomment this for the alpha patch / ALPHA_PATCH -XRENDER = -lXrender +#XRENDER = `$(PKG_CONFIG) --libs xrender` # Uncomment this for the themed cursor patch / THEMED_CURSOR_PATCH -XCURSOR = -lXcursor +#XCURSOR = `$(PKG_CONFIG) --libs xcursor` # Uncomment the lines below for the ligatures patch / LIGATURES_PATCH LIGATURES_C = hb.c @@ -28,18 +30,22 @@ LIGATURES_LIBS = `$(PKG_CONFIG) --libs harfbuzz` SIXEL_C = sixel.c sixel_hls.c SIXEL_LIBS = `$(PKG_CONFIG) --libs imlib2` +# Uncomment for the netwmicon patch / NETWMICON_PATCH +#NETWMICON_LIBS = `$(PKG_CONFIG) --libs gdlib` + # includes and libs, uncomment harfbuzz for the ligatures patch INCS = -I$(X11INC) \ `$(PKG_CONFIG) --cflags fontconfig` \ `$(PKG_CONFIG) --cflags freetype2` \ $(LIGATURES_INC) -LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft ${XRENDER} ${XCURSOR}\ +LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft ${SIXEL_LIBS} ${XRENDER} ${XCURSOR}\ `$(PKG_CONFIG) --libs fontconfig` \ `$(PKG_CONFIG) --libs freetype2` \ - $(LIGATURES_LIBS) + $(LIGATURES_LIBS) \ + $(NETWMICON_LIBS) # flags -STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 +STCPPFLAGS = -DVERSION=\"$(VERSION)\" -DICON=\"$(ICONPREFIX)/$(ICONNAME)\" -D_XOPEN_SOURCE=600 STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS) STLDFLAGS = $(LIBS) $(LDFLAGS) diff --git a/patches.h b/patches.h index 7cab373..b0b82dd 100644 --- a/patches.h +++ b/patches.h @@ -398,7 +398,7 @@ * when including this patch. * https://st.suckless.org/patches/themed_cursor/ */ -#define THEMED_CURSOR_PATCH 1 +#define THEMED_CURSOR_PATCH 0 /* Adds support for special underlines. * diff --git a/patches/font-features.diff b/patches/font-features.diff index d545164..8607b29 100644 --- a/patches/font-features.diff +++ b/patches/font-features.diff @@ -4,7 +4,7 @@ * e. g. * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') */ --hb_feature_t features[] = { 0 }; +-hb_feature_t features[] = { }; +hb_feature_t features[] = { + FEATURE('c','v','0','2'), + FEATURE('c','v','1','6'),