qb: Add some exit if error 👍
This commit is contained in:
parent
b76c9a55c2
commit
c479300999
29
qb
29
qb
@ -133,22 +133,25 @@ focus_to_qutebrowser() { # {{{
|
||||
qutebrowser_window_id=$(command wmctrl -l | grep --max-count=1 -E -- "${QUTEBROWSER_WINDOW_TITLE}" | 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}."
|
||||
Qutebrowser window ID (window title: ${QUTEBROWSER_WINDOW_TITLE}) : ${RED}${qutebrowser_window_id}${COLOR_DEBUG} on desktop ID : ${RED}${qutebrowser_desktop_id}${COLOR_DEBUG}."
|
||||
|
||||
### Switch to Qutebrowser desktop
|
||||
command wmctrl -s "${qutebrowser_desktop_id}"
|
||||
command wmctrl -s "${qutebrowser_desktop_id}" \
|
||||
|| error_message "focus_to_qutebrowser - Fail to switch to desktop ID of Qutebrowser (${qutebrowser_desktop_id})." 90
|
||||
|
||||
## If HerstluftWM is available
|
||||
if [ "$(command -v herbstclient)" ]; then
|
||||
debug_message "focus_to_qutebrowser − \
|
||||
Focus with herbstclient."
|
||||
### Focus to the window id
|
||||
herbstclient jumpto "${qutebrowser_window_id}"
|
||||
herbstclient jumpto "${qutebrowser_window_id}" \
|
||||
|| error_message "focus_to_qutebrowser - Fail to switch to Qutebrowser Window ID (${qutebrowser_window_id}) with herbstclient." 91
|
||||
else
|
||||
debug_message "focus_to_qutebrowser − \
|
||||
Focus with wmctrl."
|
||||
### Switch expected window
|
||||
command wmctrl -i -R "${qutebrowser_window_id}"
|
||||
command wmctrl -i -R "${qutebrowser_window_id}" \
|
||||
|| error_message "focus_to_qutebrowser - Fail to switch to Qutebrowser Window ID (${qutebrowser_window_id}) with wmctrl." 92
|
||||
fi
|
||||
|
||||
}
|
||||
@ -160,7 +163,8 @@ get_qutebrowser_buffers() { # {{{
|
||||
|
||||
## Run save_buffers.py in Qutebrowser
|
||||
echo '{"args":[":save-window-and-buffers"], "target_arg":"", "protocol_version":1}' |\
|
||||
socat - UNIX-CONNECT:"$QUTEBROWSER_SOCKET_FILE"
|
||||
socat - UNIX-CONNECT:"$QUTEBROWSER_SOCKET_FILE" \
|
||||
|| error_message "get_qutebrowser_buffers - Fail to contact ${QUTEBROWSER_SOCKET_FILE} socket file." 20
|
||||
|
||||
## Wait to get the buffers list
|
||||
i="0"
|
||||
@ -173,7 +177,8 @@ get_qutebrowser_buffers() { # {{{
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
sed "s/^/ff /g" "${QUTEBROWSER_SESSION_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}"
|
||||
sed "s/^/ff /g" "${QUTEBROWSER_SESSION_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}" \
|
||||
|| error_message "get_qutebrowser_buffers - Fail on removing 'ff ' buffer prefix." 21
|
||||
|
||||
}
|
||||
# }}}
|
||||
@ -183,8 +188,13 @@ get_qutebrowser_content() { # {{{
|
||||
|
||||
get_qutebrowser_searchengine
|
||||
|
||||
[ -f "${QUTEBROWSER_QUICKMARK_FILE}" ] && sed "s/^/qq /g" "${QUTEBROWSER_QUICKMARK_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}"
|
||||
[ -f "${QUTEBROWSER_BOOKMARK_FILE}" ] && sed "s/^/bb /g" "${QUTEBROWSER_BOOKMARK_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}"
|
||||
[ -f "${QUTEBROWSER_QUICKMARK_FILE}" ] \
|
||||
&& sed "s/^/qq /g" "${QUTEBROWSER_QUICKMARK_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}" \
|
||||
|| error_message "get_qutebrowser_content - Fail on removing 'qq ' quickmark prefix" 22
|
||||
|
||||
[ -f "${QUTEBROWSER_BOOKMARK_FILE}" ] \
|
||||
&& sed "s/^/bb /g" "${QUTEBROWSER_BOOKMARK_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}" \
|
||||
|| error_message "get_qutebrowser_content - Fail on removing 'bb ' bookmark prefix" 23
|
||||
|
||||
}
|
||||
# }}}
|
||||
@ -219,7 +229,8 @@ goto_qutebrowser_content() { # {{{
|
||||
debug_message "goto_qutebrowser_content − \
|
||||
Search in Qutebrowser's content ${QUTEBROWSER_GLOBAL_CONTENT} file."
|
||||
|
||||
rofi -theme solarized_alternate -dmenu -location 6 -l 15 -theme-str 'window {width: 80%;}' -p 'Qutebrowser' > "${choice_temp_file}" < "${QUTEBROWSER_GLOBAL_CONTENT}"
|
||||
rofi -theme solarized_alternate -dmenu -location 6 -l 15 -theme-str 'window {width: 80%;}' -p 'Qutebrowser' > "${choice_temp_file}" < "${QUTEBROWSER_GLOBAL_CONTENT}" \
|
||||
|| error_message "goto_qutebrowser_content - Fail to display ${QUTEBROWSER_GLOBAL_CONTENT} with Rofi." 24
|
||||
|
||||
if [ -s "${choice_temp_file}" ]; then
|
||||
debug_message "goto_qutebrowser_content − \
|
||||
|
Loading…
Reference in New Issue
Block a user