summaryrefslogtreecommitdiff
path: root/scripts/gui/br
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gui/br')
-rwxr-xr-xscripts/gui/br32
1 files changed, 12 insertions, 20 deletions
diff --git a/scripts/gui/br b/scripts/gui/br
index 474b1b1..428e24b 100755
--- a/scripts/gui/br
+++ b/scripts/gui/br
@@ -1,6 +1,6 @@
#!/bin/sh
-. slib
+. "lib_common.sh"
help() {
cat << EOF
@@ -9,33 +9,25 @@ options:
[link] Open link
-h Print this message and exit
-NOTE: bookmarks file is located at ~/.config/sites/bookmarks
+NOTE: bookmarks file is located at ~/.config/sites/bookmarks.txt
EOF
-
exit 0
}
-alias dmenucmd="dmenu -bw 1 -c -g 1 -l 25"
-
-[ -z "${BROWSER}" ] && browser="qutebrowser" || browser="${BROWSER}"
+[ -z "${BROWSER}" ] && BROWSER="firefox"
if [ "${#}" -eq 0 ]; then
+ bookmark_path="${XDG_CONFIG_HOME:-$HOME/.config}/sites/bookmarks.txt"
+ [ -e "${bookmark_path}" ] || err "Couldn't find bookmarks file"
- link_file="${XDG_CONFIG_HOME:-$HOME/.config}/sites/bookmarks.txt"
-
- check_program "dmenu"
+ . "lib_handle.sh"
- [ -z "${XDG_HOME_CONFIG}" ] || link_file="${XDG_HOME_CONFIG}"/sites/bookmarks.txt
- [ -e "${link_file}" ] || err "Couldn't find bookmarks file"
+ link=$(< "${bookmark_path}" menu_handle center)
- link=$(< "${link_file}" dmenucmd)
-
- [ -z "${link}" ] || "${browser}" "${link}"
+ [ -z "${link}" ] || "${BROWSER}" "${link}"
+fi
-elif [ "${#}" -eq 1 ]; then
- [ "${1}" = "-h" ] && help
+[ "${#}" -ne 1 ] && invalid_use
+[ "${1}" = "-h" ] && help
- "${browser}" "${1}"
-else
- invalid_use
-fi
+"${BROWSER}" "${1}"