summaryrefslogtreecommitdiff
path: root/scripts/gui/br
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
commitcb78290f31886fb1f9a5e7c2a764dda55a459e50 (patch)
tree72a2df0645405658d8590d4b8d7d87f1e099f596 /scripts/gui/br
parentf8d1bfbd0f27e0763cf75fcda58d010e346515ab (diff)
chore: split script installation into CLI and GUI sections
Diffstat (limited to 'scripts/gui/br')
-rwxr-xr-xscripts/gui/br42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/gui/br b/scripts/gui/br
new file mode 100755
index 0000000..0fd6dc5
--- /dev/null
+++ b/scripts/gui/br
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Open links from bookmarks through dmenu
+options:
+[link] Open link
+ -h Print this message and exit
+
+NOTE: bookmarks file is located at ~/.config/sites/bookmarks
+EOF
+
+exit 0
+}
+
+alias dmenucmd="dmenu -bw 1 -c -g 1 -l 25"
+
+[ -z "${BROWSER}" ] && browser="qutebrowser" || browser="${BROWSER}"
+
+if [ "${#}" -eq 0 ]; then
+
+ # FIXME: Use XDG_CONFIG
+ link_file="${HOME}/.config"/sites/bookmarks.txt
+
+ check_program "dmenu"
+
+ [ -z "${XDG_HOME_CONFIG}" ] || link_file="${XDG_HOME_CONFIG}"/sites/bookmarks.txt
+ [ -e "${link_file}" ] || err "Couldn't find bookmarks file"
+
+ link=$(< "${link_file}" dmenucmd)
+
+ [ -z "${link}" ] || "${browser}" "${link}"
+
+elif [ "${#}" -eq 1 ]; then
+ [ "${1}" = "-h" ] && help
+
+ "${browser}" "${1}"
+else
+ invalid_use
+fi