diff --git a/qb b/qb index 69c6c90..4b5f83c 100755 --- a/qb +++ b/qb @@ -154,6 +154,21 @@ Qutebrowser from ${RED}git repository${COLOR_DEBUG} not selected or can't be use return "${local_get_qutebrowser_bin_return}" +} +# }}} +focus_to_qutebrowser() { # {{{ + + ## Get desktop and window ID of the first "qutebrowser" window + qutebrowser_desktop_id=$(command wmctrl -l | grep --max-count=1 "qutebrowser" | cut -d" " -f3) + qutebrowser_window_id=$(command wmctrl -l | grep --max-count=1 "qutebrowser" | cut -d" " -f1) + + debug_message "focus_to_qutebrowser − \ +Qutebrowser window ID : ${RED}${qutebrowser_window_id}${COLOR_DEBUG} on desktop ID : ${RED}${qutebrowser_desktop_id}${COLOR_DEBUG}." + + ## Switch to Qutebrowser desktop and first window + command wmctrl -s "${qutebrowser_desktop_id}" + command wmctrl -i -R "${qutebrowser_window_id}" + } # }}} goto_existing_qutebrowser() { # {{{ @@ -161,9 +176,15 @@ goto_existing_qutebrowser() { # {{{ debug_message "goto_existing_qutebrowser − \ Try to open content in existing instance." + ## Focus to Qutebrowser window + focus_to_qutebrowser + + ## Try to open Qutebrowser content search_qb_bookmark \ && open_in_qutebrowser + return 0 + } # }}} search_qb_bookmark() { # {{{ @@ -235,7 +256,8 @@ main() { # {{{ || exit 0 ## Manage existing instance - goto_existing_qutebrowser + goto_existing_qutebrowser \ + && exit 0 } # }}}