summaryrefslogtreecommitdiff
path: root/scripts/open_url_in_instance.sh
blob: ec2a5a26d9eda146445148cee4c28b4065596e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# initial idea: Florian Bruhin (The-Compiler)
# author: Thore Bödecker (foxxx0)

_url="$1"
_qb_version='1.0.4'
_proto_version=1
_ipc_socket="${XDG_RUNTIME_DIR}/qutebrowser/ipc-$(echo -n "$USER" | md5sum | cut -d' ' -f1)"
_qute_bin="/usr/bin/qutebrowser"

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}" 2>/dev/null || "$_qute_bin" "$@" &