[sxhkd] Fix pipe enabled sxhkd start
This commit is contained in:
parent
75a8978a0a
commit
4d96b19163
2 changed files with 3 additions and 2 deletions
31
sxhkd/.local/bin/sxhkd-piped
Executable file
31
sxhkd/.local/bin/sxhkd-piped
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/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 "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue