blob: 797f40f0ef2968552209f29c439bde40faac8b38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/sh
url="$(grep -o -e 'http://[^"]*' -e 'https://[^"]*' <&0 | tr ' ' '\n' | fzf)"
[ "$url" = "" ] && exit
choices="\
clipboard
browser/xdg-open"
choice=$(echo "$choices" | fzf)
[ "$choice" = "" ] && exit
choice=$(echo "$choice" | sed -e 's/browser\/xdg-open/xdg-open/') # browser/xdg-open should just run xdg-open
if [ "$choice" = "clipboard" ]; then
if [ -z "$WAYLAND_DISPLAY" ]; then
printf -- "%s" "$url" | xclip -selection clipboard
else
printf -- "%s" "$url" | wl-copy
fi
else
$choice "$url" & disown
fi
|