1
0
mirror of https://github.com/tiyn/st synced 2025-10-28 01:31:21 +01:00

5 Commits

Author SHA1 Message Date
ea17e8482c added st-copyout to config 2023-11-08 15:23:50 +01:00
5a9bb12e32 added copyout to config 2023-11-08 15:14:19 +01:00
85b0517a66 added copyout config 2023-11-08 15:12:22 +01:00
3ec0bd40b0 updated repository title in readme 2023-10-24 06:09:48 +02:00
c89bbcf33d updated readme and gitignore 2023-10-22 05:42:34 +02:00
5 changed files with 50 additions and 21 deletions

2
.gitignore vendored
View File

@@ -50,3 +50,5 @@ modules.order
Module.symvers Module.symvers
Mkfile.old Mkfile.old
dkms.conf dkms.conf
st

View File

@@ -4,7 +4,7 @@
include config.mk include config.mk
SRC = st.c x.c SRC = st.c x.c hb.c
OBJ = $(SRC:.c=.o) OBJ = $(SRC:.c=.o)
all: options st all: options st
@@ -22,7 +22,8 @@ config.h:
$(CC) $(STCFLAGS) -c $< $(CC) $(STCFLAGS) -c $<
st.o: config.h st.h win.h st.o: config.h st.h win.h
x.o: arg.h config.h st.h win.h x.o: arg.h config.h st.h win.h hb.h
hb.o: st.h
$(OBJ): config.h config.mk $(OBJ): config.h config.mk
@@ -43,7 +44,9 @@ dist: clean
install: st install: st
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f st $(DESTDIR)$(PREFIX)/bin cp -f st $(DESTDIR)$(PREFIX)/bin
cp -f st-copyout $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/st chmod 755 $(DESTDIR)$(PREFIX)/bin/st
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-copyout
mkdir -p $(DESTDIR)$(MANPREFIX)/man1 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1 sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
@@ -52,6 +55,8 @@ install: st
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/st rm -f $(DESTDIR)$(PREFIX)/bin/st
rm -f $(DESTDIR)$(PREFIX)/bin/st-copyout
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
.PHONY: all options clean dist install uninstall .PHONY: all options clean dist install uninstall

View File

@@ -8,8 +8,10 @@ It is supposed to work in the environment after the larbs-base-installation.
The list below shows the currently applied patches to the master branch. The list below shows the currently applied patches to the master branch.
- st-alpha-20220206-0.8.5.diff (adds transparency)
- st-anysize-20220718-baa9357.diff (st leaves no gaps if the height/width doesn't match a multiple of - st-anysize-20220718-baa9357.diff (st leaves no gaps if the height/width doesn't match a multiple of
character height) character height)
- st-externalpipe-0.8.4.diff (allows reading and writing st's screen through a pipe)
- st-ligatures-scrollback-20230105-0.9.diff (scrollback compatible addition of ligatures) - st-ligatures-scrollback-20230105-0.9.diff (scrollback compatible addition of ligatures)
- st-scrollback-0.8.5.diff (add scrollback functionality) - st-scrollback-0.8.5.diff (add scrollback functionality)
@@ -17,26 +19,27 @@ The list below shows the currently applied patches to the master branch.
There are various shortcuts and hotkeys used in this version. Included in my build are the following. There are various shortcuts and hotkeys used in this version. Included in my build are the following.
| ModKey | Shift | Key | Function | | ModKey | Shift | Key | Function |
| ------ | ----- | --------------- | --------------- | | ------ | ----- | --------------- | -------------------------------------------- |
| Alt | | Break | Send break | | Alt | | Break | Send break |
| Alt | | Print | Toggle printer | | Alt | | Print | Toggle printer |
| Alt | | Print | Print screen | | Alt | | Print | Print screen |
| | Shift | Insert | Clipboard paste | | | Shift | Insert | Clipboard paste |
| Alt | | c | Clipboard copy | | Alt | | c | Clipboard copy |
| Alt | | v | Clipboard paste | | Alt | | v | Clipboard paste |
| Alt | | p | Selected paste | | Alt | | p | Selected paste |
| Alt | | NumLock | Toggle Numlock | | Alt | | NumLock | Toggle Numlock |
| Alt | | k | Scroll up | | Alt | | k | Scroll up |
| Alt | | j | Scroll down | | Alt | | j | Scroll down |
| | | MouseScrollUp | Scroll up | | | | MouseScrollUp | Scroll up |
| | | MouseScrollDown | Scroll down | | | | MouseScrollDown | Scroll down |
| Alt | Shift | u | Zoom in | | Alt | Shift | u | Zoom in |
| Alt | Shift | i | Zoom out | | Alt | Shift | i | Zoom out |
| Alt | | o | copy output of previous command to clipboard |
## Installation ## Installation
The most basic way is to clone the repository and then invoke make. The most basic way is to clone the repository and then invoke make.
- `git clone https://github.com/tiyn/st-0.9.0` - `git clone https://github.com/tiyn/st`
- `make clean install` - `make clean install`

View File

@@ -93,10 +93,13 @@ char *termname = "st-256color";
*/ */
unsigned int tabspaces = 8; unsigned int tabspaces = 8;
/* bg opacity */
float alpha = 1.0;
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* 8 normal colors */ /* 8 normal colors */
"#1e1e1e", "#191919",
"#f44747", "#f44747",
"#608b4e", "#608b4e",
"#dcdcaa", "#dcdcaa",
@@ -114,7 +117,7 @@ static const char *colorname[] = {
"#d4d4d4", "#d4d4d4",
[255] = 0, [255] = 0,
/* more colors can be added after 255 to use with DefaultXX */ /* more colors can be added after 255 to use with DefaultXX */
"#1e1e1e", /* 256 -> bg */ "#191919", /* 256 -> bg */
"#d4d4d4", /* 257 -> fg */ "#d4d4d4", /* 257 -> fg */
"#a4a4a4", /* 258 -> cursor */ "#a4a4a4", /* 258 -> cursor */
}; };
@@ -181,6 +184,8 @@ static MouseShortcut mshortcuts[] = {
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask) #define TERMMOD (ControlMask|ShiftMask)
static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL };
static Shortcut shortcuts[] = { static Shortcut shortcuts[] = {
/* mask keysym function argument */ /* mask keysym function argument */
{ MODKEY, XK_Break, sendbreak, {.i = 0} }, { MODKEY, XK_Break, sendbreak, {.i = 0} },
@@ -196,6 +201,7 @@ static Shortcut shortcuts[] = {
{ MODKEY, XK_U, zoom, {.f = +1} }, { MODKEY, XK_U, zoom, {.f = +1} },
{ MODKEY|ShiftMask, XK_U, zoom, {.f = +1} }, { MODKEY|ShiftMask, XK_U, zoom, {.f = +1} },
{ MODKEY|ShiftMask, XK_I, zoom, {.f = -1} }, { MODKEY|ShiftMask, XK_I, zoom, {.f = -1} },
{ MODKEY, XK_o, externalpipe, {.v = copyoutput } },
}; };
/* /*

13
st-copyout Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# Using external pipe with st, give a dmenu prompt of recent commands,
# allowing the user to copy the output of one.
# xclip required for this script.
# By Jaywalker and Luke
tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX)
trap 'rm "$tmpfile"' 0 1 15
sed -n "w $tmpfile"
sed -i 's/\x0//g' "$tmpfile"
ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)"
chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -p "Copy which command's output?" -i -l 10 | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
awk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard