copy output of command with alt-o
This commit is contained in:
parent
140c6b0a3f
commit
84d49f527d
3
Makefile
3
Makefile
|
@ -43,7 +43,9 @@ dist: clean
|
|||
install: st
|
||||
mkdir -p $(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-copyout
|
||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
|
@ -52,6 +54,7 @@ install: st
|
|||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/st-copyout
|
||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
|
||||
.PHONY: all options clean dist install uninstall
|
||||
|
|
42
README.md
42
README.md
|
@ -1,32 +1,33 @@
|
|||
# Luke's build of st - the simple (suckless) terminal
|
||||
|
||||
The [suckless terminal (st)](https://st.suckless.org/) with some additional features:
|
||||
The [suckless terminal (st)](https://st.suckless.org/) with some additional features that make it literally the best terminal emulator ever:
|
||||
|
||||
## Unique features (using dmenu)
|
||||
|
||||
+ *follow urls* by pressing `alt-l`
|
||||
+ *copy urls* in the same way with `alt-y`
|
||||
+ *copy the output of commands* with `alt-o`
|
||||
|
||||
## Bindings for
|
||||
|
||||
+ *scrollback* with `alt-↑/↓` or `alt-pageup/down` or `shift` while scrolling the mouse
|
||||
+ OR *vim-bindings*: scroll up/down in history with `alt-k` and `alt-j`. Faster with `alt-u`/`alt-d`.
|
||||
+ *zoom/change font size*: same bindings as above, but holding down shift as well. `alt-home` returns to default
|
||||
+ *copy text* with `alt-c`, *paste* is `alt-v` or `shift-insert`
|
||||
|
||||
## Pretty stuff
|
||||
|
||||
+ Compatibility with `Xresources` and `pywal` for dynamic colors. The `Xdefaults` file shows a usage example.
|
||||
+ Default [gruvbox](https://github.com/morhetz/gruvbox) colors otherwise.
|
||||
+ Transparency/alpha, which is also adjustable from `~/.Xresources`.
|
||||
+ Transparency/alpha, which is also adjustable from your `Xresources`.
|
||||
+ Default font is system "mono" at 16pt, meaning the font will match your system font.
|
||||
+ Very useful keybinds including:
|
||||
+ Copy is alt-c, paste is alt-v or alt-p pastes from primary selection
|
||||
+ Alt-l feeds all urls on screen to dmenu, so they user can choose and
|
||||
follow one (requires dmenu installed).
|
||||
+ Alt-y does the same as above, but copies the url with xclip.
|
||||
+ Zoom in/out or increase font size with Alt+Shift+k/j or u/d for larger intervals.
|
||||
+ Hold alt and press either ↑/↓ or the vim keys k/j to move up/down in the terminal.
|
||||
+ Shift+Mouse wheel do the same.
|
||||
+ Alt-u and Alt-d scroll back/forward in history a page at a time.
|
||||
+ Alt-PageUp and Alt-PageDown will do the same.
|
||||
|
||||
## Other st patches
|
||||
|
||||
+ Vertcenter
|
||||
+ Scrollback
|
||||
+ updated to latest version 0.8.2
|
||||
|
||||
The following additional bindings were added before I forked this:
|
||||
|
||||
+ Scroll through history -- Shift+PageUp/PageDown or Shift+Mouse wheel
|
||||
+ Increase/decrease font size -- Shift+Alt+PageUp/PageDown
|
||||
+ Return to default font size -- Alt+Home
|
||||
+ Paste -- Shift+Insert
|
||||
|
||||
## Installation for newbs
|
||||
|
||||
```
|
||||
|
@ -56,8 +57,7 @@ For example, you can define your desired fonts, transparency or colors:
|
|||
...
|
||||
```
|
||||
|
||||
The `alpha` value (for transparency) goes from `0` (transparent) to `1`
|
||||
(opaque).
|
||||
The `alpha` value (for transparency) goes from `0` (transparent) to `1` (opaque).
|
||||
|
||||
### Colors
|
||||
|
||||
|
|
3
config.h
3
config.h
|
@ -217,6 +217,8 @@ static char *copyurlcmd[] = { "/bin/sh", "-c",
|
|||
"sed 's/.*│//g' | tr -d '\n' | grep -aEo '((http|https)://|www\\.)[a-zA-Z0-9./&?=_-]*' | uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -p 'Copy which url?' -l 10 | tr -d '\n' | xclip -selection clipboard",
|
||||
"externalpipe", NULL };
|
||||
|
||||
static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL };
|
||||
|
||||
static Shortcut shortcuts[] = {
|
||||
/* mask keysym function argument */
|
||||
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
|
||||
|
@ -250,6 +252,7 @@ static Shortcut shortcuts[] = {
|
|||
{ TERMMOD, XK_D, zoom, {.f = -2} },
|
||||
{ MODKEY, XK_l, externalpipe, {.v = openurlcmd } },
|
||||
{ MODKEY, XK_y, externalpipe, {.v = copyurlcmd } },
|
||||
{ MODKEY, XK_o, externalpipe, {.v = copyoutput } },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
12
st-copyout
Executable file
12
st-copyout
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/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"
|
||||
ps1="$(grep "\S" "$tmpfile" | tail -n 1 | 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
|
5
st.1
5
st.1
|
@ -152,6 +152,11 @@ Show dmenu menu of all URLs on screen and choose one to open.
|
|||
.B Alt-y
|
||||
Show dmenu menu of all URLs on screen and choose one to copy.
|
||||
.TP
|
||||
.B Alt-o
|
||||
Show dmenu menu of all recently run commands and copy the output of the chosen command to the clipboard.
|
||||
.I xclip
|
||||
required.
|
||||
.TP
|
||||
.B Break
|
||||
Send a break in the serial line.
|
||||
Break key is obtained in PC keyboards
|
||||
|
|
Loading…
Reference in New Issue
Block a user