diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2026-06-21 19:01:25 +0100 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2026-06-21 19:07:53 +0100 |
| commit | aebda32c2a09fcbdc1e645f55a0c6de3b9a2cfaf (patch) | |
| tree | bac91eea7c658a6836f5486da562e258e9a8aba0 /bin/.bin/open-bookmark.sh | |
| parent | b2e8d5fc138d1ee9bb0eb0e4e3bf524a45d9fe25 (diff) | |
Add bookmark management scripts
Diffstat (limited to 'bin/.bin/open-bookmark.sh')
| -rwxr-xr-x | bin/.bin/open-bookmark.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/.bin/open-bookmark.sh b/bin/.bin/open-bookmark.sh new file mode 100755 index 0000000..67e724b --- /dev/null +++ b/bin/.bin/open-bookmark.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +BOOKMARKS_FILE="$DOTFILES_REPO/bookmarks.txt" + +if [ ! -f "$BOOKMARKS_FILE" ] || [ ! -s "$BOOKMARKS_FILE" ]; then + notify-send "Bookmarks" "Your bookmarks file is empty or missing." + exit 1 +fi + +SELECTION=$(cut -d'|' -f1 "$BOOKMARKS_FILE" | rofi -dmenu -p "Go To:") + +if [ -z "$SELECTION" ]; then + exit 0 +fi + +URL=$(grep "^$SELECTION|" "$BOOKMARKS_FILE" | head -n 1 | cut -d'|' -f2) + +if [ -n "$URL" ]; then + firefox "$URL" & +else + notify-send "Error" "Could not resolve the URL for: $SELECTION" +fi |
