Add variables for possibles Qutebrowser paths

This commit is contained in:
Jeremy Gardais 2020-12-02 17:09:30 +01:00
parent 15a129feb4
commit 5bb2d6da76
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 10 additions and 6 deletions

16
qb
View File

@ -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