summaryrefslogtreecommitdiff
path: root/bin/.bin/open-bookmark.sh
diff options
context:
space:
mode:
authorDavid Sadler <david@flashacademy.com>2026-07-07 09:15:46 +0100
committerDavid Sadler <david@flashacademy.com>2026-07-07 09:15:46 +0100
commit626c119a60701e2908e5795b3941078ebb8dba6b (patch)
treead8b6577953f50ad958051ef1d2493e8785ad4cb /bin/.bin/open-bookmark.sh
parent4c8d52122d962a0194737450e825471f27c93451 (diff)
parentfc2b007057dc763de14f9cd7860360bc5c9b646e (diff)
Merge branch 'main' into WSL
Diffstat (limited to 'bin/.bin/open-bookmark.sh')
-rwxr-xr-xbin/.bin/open-bookmark.sh23
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