From 894fe548ff127d548f6a4bb694aa0ff7bf3730f1 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 2 Dec 2020 20:02:35 +0100 Subject: [PATCH] Use herbstclient if available for focusing --- qb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/qb b/qb index b880432..33f8a56 100755 --- a/qb +++ b/qb @@ -199,9 +199,19 @@ focus_to_qutebrowser() { # {{{ 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}" + ## If HerstluftWM is available + if [ "$(command -v herbstclient)" ]; then + debug_message "focus_to_qutebrowser − \ +Focus with herbstclient." + ### Direct focus to the window id + herbstclient jumpto "${qutebrowser_window_id}" + else + debug_message "focus_to_qutebrowser − \ +Focus with wmctrl." + ### Switch to Qutebrowser desktop and expected window + command wmctrl -s "${qutebrowser_desktop_id}" + command wmctrl -i -R "${qutebrowser_window_id}" + fi } # }}}