Marty Oehme
cb5f09c414
Script can be used in a statusbar or otherwise and will return the currently active sxhkd mode. Look into the README for further explanation.
30 lines
573 B
Bash
30 lines
573 B
Bash
#!/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
|
|
|
|
}
|