1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/packages/scripts/klemmbrett.sh
2020-06-04 13:29:45 +02:00

30 lines
672 B
Bash
Executable File

#!/bin/sh
options='Pastebin
Shorten
[Replace p.r]'
r_to_krebscode() {
sed 's/\<r\>/krebsco.de/'
}
modify_clipboard() {
case $(echo "$options" | dmenu -i -p 'clipboard') in
'Pastebin')
curl -fSs -F 'f:1=<-' ix.io
# curl -fSs http://p.r --data-binary @- | tail --lines=1 | r_to_krebscode
;;
'Shorten')
# curl -fSs "http://tinyurl.com/api-create.php?url=$(cat)"
curl -fSs "https://0x0.st" -F "shorten=$(cat)"
# curl -fSs http://go.r -F "uri=$(cat)"
;;
'Replace p.r') r_to_krebscode ;;
*) cat;;
esac
}
xclip -selection clipboard -out \
| modify_clipboard \
| tr -d '\r\n' \
| xclip -selection clipboard -in