From d947956270b092df10637bb3531441caca698b86 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Tue, 25 Nov 2025 18:47:27 +0400 Subject: feat: new api for scripts --- scripts/gui/br | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'scripts/gui/br') 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}" -- cgit v1.2.3