From 5bb2d6da765993f59bbbe1259600776c4f08300a Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 2 Dec 2020 17:09:30 +0100 Subject: [PATCH] Add variables for possibles Qutebrowser paths --- qb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/qb b/qb index 5efd39c..2e63200 100755 --- a/qb +++ b/qb @@ -54,6 +54,10 @@ define_vars() { # {{{ ## Use Qutebrowser from Python Virtual Environment by default QB_VENV_MODE="0" + ## Qutebrowser possibles paths + QB_VENV_PYTHON_PATH="${HOME}/src/qutebrowser-venv/bin/python3" + QB_GIT_REPOSITORY="${HOME}/repos/qutebrowser" + ## Store selected content to a temp file choice_temp_file="$(mktemp -t ${PROGNAME}-XXXXXX.tmp)" @@ -108,10 +112,10 @@ get_qutebrowser_bin() { # {{{ local_get_qutebrowser_bin_return="1" ## First try venv {{{ - if [ "${QB_VENV_MODE}" -eq "0" ] && [ -f ~/src/qutebrowser-venv/bin/python3 ]; then + if [ "${QB_VENV_MODE}" -eq "0" ] && [ -f "${QB_VENV_PYTHON_PATH}" ]; then debug_message "get_qutebrowser_bin − \ Qutebrowser from ${RED}venv${COLOR_DEBUG} can be used." - QUTEBROWSER_BIN="${HOME}/src/qutebrowser-venv/bin/python3 -m qutebrowser" + QUTEBROWSER_BIN="${QB_VENV_PYTHON_PATH} -m qutebrowser" local_get_qutebrowser_bin_return="0" ### Be sure to skip other MODE if not already defined [ -z "${QB_PACKAGE_MODE}" ] && QB_PACKAGE_MODE="1" @@ -141,8 +145,8 @@ Qutebrowser from ${RED}package${COLOR_DEBUG} not selected or can't be used." ## }}} ## Finally, try git repository {{{ - if [ "${QB_GIT_MODE}" -eq "0" ] && [ -f ~/repos/qutebrowser/qutebrowser.py ]; then - QUTEBROWSER_BIN="${HOME}/repos/qutebrowser/qutebrowser.py --backend webengine" + if [ "${QB_GIT_MODE}" -eq "0" ] && [ -f "${QB_GIT_REPOSITORY}/qutebrowser.py" ]; then + QUTEBROWSER_BIN="${QB_GIT_REPOSITORY}/qutebrowser.py --backend webengine" debug_message "get_qutebrowser_bin − \ Qutebrowser from ${RED}Git repository${COLOR_DEBUG} will finally be used." local_get_qutebrowser_bin_return="0" @@ -215,8 +219,8 @@ start_qutebrowser() { # {{{ Qutebrowser is already started." else debug_message "start_qutebrowser − \ -No existing instance of Qutebrowser. Starting…" - "${QUTEBROWSER_BIN}" +No existing instance of Qutebrowser. Starting…" >> /tmp/qb.log + sh -c "${QUTEBROWSER_BIN}" local_start_qutebrowser_return="0" fi