dmenu-bookmarks 418 B

12345678910111213141516171819202122
  1. #!/bin/sh --
  2. set -ue
  3. BM_FILE="${XDG_DATA_HOME:-${HOME}/.local/share}/bookmarks.txt"
  4. [ -f "${BM_FILE}" ]
  5. url="$(
  6. sed -e 's/^\s*#.*$//' -e '/^\s*$/d' <"${BM_FILE}" |
  7. dmenu -l 10 -p 'bookmarks:'
  8. )"
  9. [ -n "${url}" ]
  10. case "${url}" in
  11. '!!!edit!!!') exec "${TERMINAL:-st}" -e "${EDITOR:-vim}" ~/.local/share/bookmarks.txt ;;
  12. esac
  13. printf '%s' "${url}" |
  14. xclip -sel c -r &&
  15. notify-send 'copied to clipboard' "${url}"