diff options
Diffstat (limited to 'env/.local/bin/scripts/urlview.sh')
| -rwxr-xr-x | env/.local/bin/scripts/urlview.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/env/.local/bin/scripts/urlview.sh b/env/.local/bin/scripts/urlview.sh new file mode 100755 index 0000000..c4c38d7 --- /dev/null +++ b/env/.local/bin/scripts/urlview.sh @@ -0,0 +1,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 |
