blob: fc559eb8382dbe981e3e94059621cbc6a3035bb4 (
plain) (
tree)
|
|
#!/bin/sh
#
# See the LICENSE file for copyright and license details.
#
# Point a running surf at a URI, or start a new one if none is running.
# Every surf window leaves a control fifo named <pid>-<pageid> behind, see
# the CONTROL FIFO section of surf(1).
uri="${1:-about:blank}"
for fifo in "${XDG_RUNTIME_DIR:-/tmp}"/surf/*; do
[ -p "$fifo" ] || continue
# a fifo of a surf that got killed would block us forever
pid="${fifo##*/}"
if ! kill -0 "${pid%%-*}" 2>/dev/null; then
rm -f "$fifo"
continue
fi
printf 'uri %s\n' "$uri" >"$fifo"
exit 0
done
exec surf "$uri"
|