#!/usr/bin/env sh # Starting sxhkd without arguments automatically creates # a fifo pipe in XDG_RUNTIME_DIR, to enable IPC for sxhkd. # Mostly used for sxhkd-chain-labels script. type sxhkd >/dev/null 2>&1 || { return 1 } # get the complete path to sxhkd to avoid # recursion later on PROG="$(type sxhkd)" PROG="${PROG##* }" FIFO="$XDG_RUNTIME_DIR"/sxhkd_fifo # create a fifo and start sxhkd with it sxhkd() { exist "$PROG" critical if [ -n "$1" ]; then "$PROG" "$@" else [ -e "$FIFO" ] && rm "$FIFO" mkfifo "$FIFO" "$PROG" -s "$FIFO" fi } sxhkd "$@"