diff options
Diffstat (limited to 'tmux-urlscan-fzf.sh')
-rwxr-xr-x | tmux-urlscan-fzf.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tmux-urlscan-fzf.sh b/tmux-urlscan-fzf.sh new file mode 100755 index 0000000..7e80702 --- /dev/null +++ b/tmux-urlscan-fzf.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +fzf_filter() { + fzf-tmux -d 50% -m -0 --no-preview -p +} + +open_url() { + if command -v xdg-open &>/dev/null; then + nohup xdg-open "$@" + elif command -v open &>/dev/null; then + nohup open "$@" + elif [[ -n $BROWSER ]]; then + nohup "$BROWSER" "$@" + fi +} + +content="$(tmux capture-pane -J -p)" + +items=$(echo $content|urlscan -n -c -d) +mapfile -t chosen < <(fzf_filter <<< "$items") + +for item in "${chosen[@]}"; do + open_url "$item" +done |