#!/bin/sh bmfile="$HOME/.local/share/bookmarks.txt" url=$(tac "$bmfile" | dmenu -i -c -l 15 -p "URL:") [ -z "$url" ] && exit # append a url to the list if it's not present and exit grep -Fq "$url" "$bmfile" || { printf "%s\n" "$url" >> "$bmfile" ; exit ; } action=$(printf "Open in browser\nCopy to clipboard" | dmenu -i -c -l 2 -p "Action:") case "$action" in "Open in browser") $BROWSER "$url" ;; "Copy to clipboard") printf "%s" "$url" | xclip -selection clipboard && notify-send "URL copied to clipboard" ;; *) exit ;; esac