diff options
author | 狼耳 <Rouji@users.noreply.github.com> | 2017-11-24 14:52:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-24 14:52:33 +0100 |
commit | 765a22189c3effa6482e87089739a21d438e261f (patch) | |
tree | 9090eaf230e28b751ee3db14b1137e1bf7318efe /scripts/open_url_in_instance.sh | |
parent | 06fc52321e0a860ed8b1d50b8beb038880d88770 (diff) | |
download | qutebrowser-765a22189c3effa6482e87089739a21d438e261f.tar.gz qutebrowser-765a22189c3effa6482e87089739a21d438e261f.zip |
check if qutebrowser process is running
Sometimes when qutebrowser crashes, it leaves the IPC socket file behind. In those cases this script still tried to use it, failed, and didn't open your URL at all.
Diffstat (limited to 'scripts/open_url_in_instance.sh')
-rwxr-xr-x | scripts/open_url_in_instance.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/open_url_in_instance.sh b/scripts/open_url_in_instance.sh index 119c3aa4f..e9c6db2a1 100755 --- a/scripts/open_url_in_instance.sh +++ b/scripts/open_url_in_instance.sh @@ -6,13 +6,14 @@ _url="$1" _qb_version='0.10.1' _proto_version=1 _ipc_socket="${XDG_RUNTIME_DIR}/qutebrowser/ipc-$(echo -n "$USER" | md5sum | cut -d' ' -f1)" +_qute_bin="/usr/bin/qutebrowser" -if [[ -e "${_ipc_socket}" ]]; then +if [[ -e "${_ipc_socket}" ]] && [[ `pgrep -f $_qute_bin` ]]; then exec printf '{"args": ["%s"], "target_arg": null, "version": "%s", "protocol_version": %d, "cwd": "%s"}\n' \ "${_url}" \ "${_qb_version}" \ "${_proto_version}" \ "${PWD}" | socat - UNIX-CONNECT:"${_ipc_socket}" else - exec /usr/bin/qutebrowser --backend webengine "$@" + exec $_qute_bin --backend webengine "$@" fi |