From 18d39a2834e3319fe2d6dd5e0a3cc8ccb5ef7ecd Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 2 Dec 2020 17:31:02 +0100 Subject: [PATCH] Specific function to get the choosen URL --- qb | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/qb b/qb index df69c22..f2a1980 100755 --- a/qb +++ b/qb @@ -218,31 +218,44 @@ Search aborded or can't find matching bookmark." } # }}} -open_in_qutebrowser() { # {{{ +get_url() { # {{{ local_content=$(cat "${choice_temp_file}") - debug_message "open_in_qutebrowser − \ + return_get_url="1" + + debug_message "get_url − \ Try to manage ${RED}$(cat "${choice_temp_file}")${COLOR_DEBUG}." case "${local_content}" in http* ) ## Classic bookmark - local_url=$(printf "%s" "${local_content}" | sed -e "s;\(http.*\) .*;\1;") - debug_message "open_in_qutebrowser − \ -Try to open classic bookmark URL ${RED}${local_url}${COLOR_DEBUG}." + url=$(printf "%s" "${local_content}" | sed -e "s;\(http.*\) .*;\1;") + return_get_url="0" + debug_message "get_url − \ +URL from classic bookmark ${RED}${url}${COLOR_DEBUG}." ;; *http* ) ## Quickmark - local_url=$(printf "%s" "${local_content}" | sed -e "s;.*\(http.*\);\1;") - debug_message "open_in_qutebrowser − \ -Try to open quickbookmark URL ${RED}${local_url}${COLOR_DEBUG}." + url=$(printf "%s" "${local_content}" | sed -e "s;.*\(http.*\);\1;") + return_get_url="0" + debug_message "get_url − \ +URL from quickmark ${RED}${url}${COLOR_DEBUG}." ;; * ) - debug_message "open_in_qutebrowser − \ -Not yet managed." + debug_message "get_url − \ +Content not yet managed." ;; esac - ~/src/qutebrowser-venv/bin/python3 -m qutebrowser "${local_url}" + return "${return_get_url}" + +} +# }}} +open_in_qutebrowser() { # {{{ + + debug_message "open_in_qutebrowser − \ +Try to open ${RED}${url}${COLOR_DEBUG}" + + sh -c "${QUTEBROWSER_BIN} ${url}" } # }}} @@ -253,6 +266,7 @@ Try to open content in existing instance." ## Try to open Qutebrowser content search_qb_bookmark \ + && get_url \ && open_in_qutebrowser return 0