From cb78290f31886fb1f9a5e7c2a764dda55a459e50 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Sun, 26 Oct 2025 22:23:31 +0400 Subject: chore: split script installation into CLI and GUI sections --- scripts/gui/br | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 scripts/gui/br (limited to 'scripts/gui/br') 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 -- cgit v1.2.3