diff options
Diffstat (limited to 'scripts/gui/br')
| -rwxr-xr-x | scripts/gui/br | 42 |
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 |
