From 7f65a6a7b9c8faa9bdefb7ad28740028988ec6ea Mon Sep 17 00:00:00 2001 From: speediegq Date: Fri, 7 Oct 2022 14:47:14 +0200 Subject: [PATCH] Merge st-next into speedie/st main branch. Old st build can be found in the 'previous' branch. This build is better in every way though! --- LICENSE | 1 + Makefile | 61 +- README | 34 + arg.h | 5 - array.h | 8 + char.h | 39 - colors.h | 25 + docs/bindlist | 1 - docs/example.Xresources | 7 - docs/patchlist | 29 - external.h | 7 +- hb.c | 13 +- keybinds.h | 44 +- mapped.h | 78 -- modifiers.h | 24 + mouse.h | 16 +- options.h | 215 +++--- config.mk => options.mk | 18 +- scripts/st_buffer | 0 scripts/st_help | 6 + scripts/st_urllist | 0 scripts/st_xurls | 0 st.c | 1543 +++++++++++++++++++-------------------- st.desktop | 2 +- st.h | 49 +- st.info | 5 +- text.h | 7 + win.h | 8 +- x.c | 384 +++------- xresources.h | 79 +- 30 files changed, 1185 insertions(+), 1523 deletions(-) create mode 100644 README delete mode 100644 char.h create mode 100644 colors.h delete mode 100644 docs/bindlist delete mode 100644 docs/example.Xresources delete mode 100644 docs/patchlist delete mode 100644 mapped.h create mode 100644 modifiers.h rename config.mk => options.mk (69%) mode change 100644 => 100755 scripts/st_buffer create mode 100644 scripts/st_help mode change 100644 => 100755 scripts/st_urllist mode change 100644 => 100755 scripts/st_xurls create mode 100644 text.h diff --git a/LICENSE b/LICENSE index 3cbf420..ef00ed4 100644 --- a/LICENSE +++ b/LICENSE @@ -14,6 +14,7 @@ MIT/X Consortium License © 2013 Michael Forney © 2013-2014 Markus Teich © 2014-2015 Laslo Hunhold +© 2021-2022 speedie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/Makefile b/Makefile index 1cc4b5b..e867109 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # See LICENSE file for copyright and license details. .POSIX: -include config.mk +include options.mk SRC = st.c x.c boxdraw.c hb.c OBJ = $(SRC:.c=.o) @@ -14,64 +14,67 @@ options: @echo "CFLAGS = $(STCFLAGS)" @echo "LDFLAGS = $(STLDFLAGS)" @echo "CC = $(CC)" + @echo "======================" .c.o: $(CC) $(STCFLAGS) -c $< st.o: options.h st.h win.h -x.o: arg.h options.h st.h win.h hb.h -hb.o: st.h +x.o: arg.h options.h st.h win.h boxdraw.o: options.h st.h boxdraw_data.h +hb.o: st.h -$(OBJ): options.h config.mk +$(OBJ): options.h options.mk st: $(OBJ) $(CC) -o $@ $(OBJ) $(STLDFLAGS) clean: - rm -f st $(OBJ) st-spde-$(VERSION).tar.gz + rm -f st $(OBJ) st-$(VERSION).tar.gz dist: clean - mkdir -p st-spde-$(VERSION) - cp -R LICENSE Makefile *.mk *.info *.h *.png *.desktop *.ttf docs scripts $(SRC)\ - st-spde-$(VERSION) - tar -cf - st-spde-$(VERSION) | gzip > st-spde-$(VERSION).tar.gz - rm -rf st-spde-$(VERSION) + mkdir -p st-$(VERSION) + cp -R LICENSE Makefile README *.mk\ + *.h *.info *.c *.png *.desktop *.ttf docs/ scripts/ \ + st-$(VERSION) + tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz + rm -rf st-$(VERSION) install: st mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f st $(DESTDIR)$(PREFIX)/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/st tic -sx st.info - @echo Please see the README file regarding the terminfo entry of st. - mkdir -p $(DESTDIR)$(ICONPREFIX) - [ -f $(ICONNAME) ] && cp -f $(ICONNAME) $(DESTDIR)$(ICONPREFIX) || : - mkdir -p $(DESTDIR)$(APPPREFIX) - cp -f st.desktop $(DESTDIR)$(APPPREFIX) + rm -f *.o st cp -f scripts/st_urllist $(DESTDIR)$(PREFIX)/bin cp -f scripts/st_buffer $(DESTDIR)$(PREFIX)/bin cp -f scripts/st_xurls $(DESTDIR)$(PREFIX)/bin + cp -f scripts/st_help $(DESTDIR)$(PREFIX)/bin chmod +x $(DESTDIR)$(PREFIX)/bin/st_urllist chmod +x $(DESTDIR)$(PREFIX)/bin/st_buffer chmod +x $(DESTDIR)$(PREFIX)/bin/st_xurls - rm -f ./st - rm -f *.o + chmod +x $(DESTDIR)$(PREFIX)/bin/st_help + mkdir -p $(DESTDIR)$(ICONPREFIX) + [ -f $(ICONNAME) ] && cp -f $(ICONNAME) $(DESTDIR)$(ICONPREFIX) || : uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/st - rm -f $(DESTDIR)$(APPPREFIX)/st.desktop + rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 rm -f $(DESTDIR)$(ICONPREFIX)/$(ICONNAME) -enablefont: - fontctrl install font.ttf - fontctrl enable font.ttf - help: - @echo "install: Install st" - @echo "uninstall: Uninstall st" - @echo "dist: Package st into st-spde-$(VERSION).tar.gz (Used for Gentoo overlays and the AUR for example)." - @echo "clean: Remove .o files and st binary" - @echo "help: Display this list" - @echo "enablefont: Install and enable the included font.ttf. You must have fontctrl installed for this to be used. If you do not, install it here: https://codeberg.org/speedie/fontctrl" + @echo "st Makefile help" + @echo + @echo "install Install st." + @echo "uninstall Uninstall st." + @echo "clean Remove st tarball and binary" + @echo "options Print compilation options." + @echo "enablefont Install the font.ttf using fontctrl." + @echo "dist Create a tarball for use with package managers or for releases." + @echo "help List of all options." -.PHONY: all options clean dist install uninstall help enablefont +enablefont: + fontctrl install font.ttf --global + fontctrl enable font.ttf --global + +.PHONY: all options clean dist install uninstall enablefont help diff --git a/README b/README new file mode 100644 index 0000000..6a846ed --- /dev/null +++ b/README @@ -0,0 +1,34 @@ +st - simple terminal +-------------------- +st is a simple terminal emulator for X which sucks less. + + +Requirements +------------ +In order to build st you need the Xlib header files. + + +Installation +------------ +Edit config.mk to match your local setup (st is installed into +the /usr/local namespace by default). + +Afterwards enter the following command to build and install st (if +necessary as root): + + make clean install + + +Running st +---------- +If you did not install st with make clean install, you must compile +the st terminfo entry with the following command: + + tic -sx st.info + +See the man page for additional details. + +Credits +------- +Based on Aurélien APTEL bt source code. + diff --git a/arg.h b/arg.h index a22e019..ee69cae 100644 --- a/arg.h +++ b/arg.h @@ -1,8 +1,3 @@ -/* - * Copy me if you can. - * by 20h - */ - #ifndef ARG_H__ #define ARG_H__ diff --git a/array.h b/array.h index 7e41f3d..993f669 100644 --- a/array.h +++ b/array.h @@ -1,3 +1,11 @@ +/* st key array */ + +/* + * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF) + * to be mapped below, add them to this array. + */ +static KeySym mappedkeys[] = { -1 }; + static Key key[] = { /* keysym mask string appkey appcursor */ { XK_KP_Home, ShiftMask, "\033[2J", 0, -1}, diff --git a/char.h b/char.h deleted file mode 100644 index 1a73fce..0000000 --- a/char.h +++ /dev/null @@ -1,39 +0,0 @@ -/* This header contains options most people probably don't want to change - * - * It is therefore hidden to keep the configuration file easy and clean to read. - */ -char *utmp = NULL; -char *scroll = NULL; -char *vtiden = "\033[?6c"; -/* More advanced example: L" `'\"()[]{}" */ -wchar_t *worddelimiters = L" "; -static uint selmasks[] = { [SEL_RECTANGULAR] = Mod1Mask }; -static char ascii_printable[] = { - " !\"#$%&'()*+,-./0123456789:;<=>?" - "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" - "`abcdefghijklmnopqrstuvwxyz{|}~" -}; - -static char *colorname[] = { - col_1, /* black */ - col_2, /* red3 */ - col_3, /* green3 */ - col_4, /* yellow3 */ - col_5, /* blue2 */ - col_6, /* magenta3 */ - col_7, /* cyan3 */ - col_8, /* gray90 */ - col_9, /* gray50 */ - col_10, /* red */ - col_11, /* green */ - col_12, /* yellow */ - col_13, /* #5c5cff */ - col_14, /* magenta */ - col_15, /* cyan */ - col_16, /* white */ - [255] = 0, - "#cccccc", - "#555555", - "#c0c5ce", - "#696969", -}; diff --git a/colors.h b/colors.h new file mode 100644 index 0000000..05c5622 --- /dev/null +++ b/colors.h @@ -0,0 +1,25 @@ +/* st color array */ + +static char *colorname[] = { + col_1, /* black */ + col_2, /* red3 */ + col_3, /* green3 */ + col_4, /* yellow3 */ + col_5, /* blue2 */ + col_6, /* magenta3 */ + col_7, /* cyan3 */ + col_8, /* gray90 */ + col_9, /* gray50 */ + col_10, /* red */ + col_11, /* green */ + col_12, /* yellow */ + col_13, /* #5c5cff */ + col_14, /* magenta */ + col_15, /* cyan */ + col_16, /* white */ + [255] = 0, + "#cccccc", + "#555555", + "#c0c5ce", + "#696969", +}; diff --git a/docs/bindlist b/docs/bindlist deleted file mode 100644 index bcc4e0b..0000000 --- a/docs/bindlist +++ /dev/null @@ -1 +0,0 @@ -bind list, not complete yet. diff --git a/docs/example.Xresources b/docs/example.Xresources deleted file mode 100644 index b3c465f..0000000 --- a/docs/example.Xresources +++ /dev/null @@ -1,7 +0,0 @@ -! This is an example .Xresources file for speedie.gq's build of st. -! -! Copy the values here to your .Xresources file by running: -! 'cat example.Xresources >> ~/.Xresources # This assumes your .Xresources is in $HOME and you're in the docs directory.' -! -! Then to load these values, add 'xrdb /path/to/.Xresources' to a script which autostarts. -! If you use Pywal then this will already be done for you. diff --git a/docs/patchlist b/docs/patchlist deleted file mode 100644 index 65c4f93..0000000 --- a/docs/patchlist +++ /dev/null @@ -1,29 +0,0 @@ -patchlist, not complete yet - -st-title-parsing-fix -st-boxdraw -st-scrollback -st-scrollback-mouse -st-boldisnotbright -st-ligatures -st-xresources -st-w3m -st-clipboard -st-columns -st-blinkingcursor -st-alpha -st-desktopentry -st-dynamiccursorcolor -st-font2 -st-netwmicon -st-clickurls -st-vertcenter -st-xclearwin -st-charoffsets -st-undercurl -st-anysize -st-xrandrfontsize -st-delkey -st-extenralpipe -st-externalpipe-eternal -st-externalpipe-signal diff --git a/external.h b/external.h index 0bfd204..19537af 100644 --- a/external.h +++ b/external.h @@ -1,4 +1,9 @@ -/* This is the header used to control extenralpipe. +/* st externalpipe + * + * Externalpipe allows the user to write scripts that can read the text on the screen and perform actions on it (basically st |