Skip to main content

max / alloy

872 B · 21 lines History Blame Raw
1 #!/bin/sh
2 # alloy-clipmenu — pick something out of the clipboard history and copy it back.
3 #
4 # The read half of docs/STACK.md#clipboard-history. The sway config has run two
5 # `wl-paste --watch cliphist store` watchers since the stack landed, so the
6 # history was being filled from the first login and there was no way to get
7 # anything out of it: no bind, no picker, no verb. STACK.md named this exact
8 # pipeline ("cliphist list piped to a TUI picker") and it was never wired.
9 #
10 # cliphist list emits `<id>\t<preview>`; decode takes the id back to the real
11 # bytes, which is what makes this work for images and for text with newlines.
12
13 set -eu
14
15 cliphist list | fzf \
16 --delimiter='\t' --with-nth=2.. \
17 --prompt='paste ' --pointer='>' --marker=' ' \
18 --layout=reverse --no-multi --no-sort --height=100% --border=none --info=inline \
19 | cliphist decode \
20 | wl-copy
21