blob: c4c38d72bdf79cb0b160dd99852c03d143d5cea9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/sh
url="$(grep -o -e 'http://[^"]*' -e 'https://[^"]*' <&0 | fzf)"
choices="\
clipboard
browser/xdg-open"
choice=$(echo "$choices" | fzf)
choice=$(echo "$choice" | sed -e 's/browser\/xdg-open/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
|