You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ACEjuice/.local/bin/acejuice-bar

70 lines
1.5 KiB

#!/bin/sh
set -e
_pid_dir="${XDG_RUNTIME_DIR:-/tmp/$(id -u)-runtime}/acejuice"
mkdir -p "$_pid_dir"
PID_FILE="$_pid_dir/ajuice-bar.pid"
unset _pid_dir
if [ -f "$PID_FILE" ]; then
while read -r pid; do
ppids="$(ps -o pid= --ppid $pid || :)"
if [ ! -z "$ppids" ]; then
printf "%s\n" "$ppids" | xargs kill -9
fi
kill -15 $pid || :
done < "$PID_FILE"
rm "$PID_FILE"
fi
# PID of this script
printf "%s\n" "$$" >> "$PID_FILE"
acejuice_monitors() {
_pipe_dir="${XDG_RUNTIME_DIR:-/tmp/$(id -u)-runtime}/acejuice"
mkdir -p "$_pipe_dir"
NPIPE_OUT="$_pipe_dir/main.sock"
unset _pipe_dir
if ! mkfifo "$NPIPE_OUT" 2> /dev/null; then
printf "fifo '%s' already present\n" "$NPIPE_OUT" >&2
fi
echo
if command -v xrandr > /dev/null; then
__monitor_list=""
OLDIFS="$IFS"
IFS="
"
for line in $(xrandr --listmonitors); do
case "$line" in
" "[0-9]*)
__monitor_list="$__monitor_list ${line##* }"
;;
*)
:
;;
esac
done
IFS="$OLDIFS"
echo "yaaa"
if [ -z "$__monitor_list" ]; then
printf ":MON LIST %s\n" "$__monitor_list" > "$NPIPE_OUT"
fi
unset __monitors_list
fi
}
acejuice_monitors &
printf "%s\n" "$!" >> "$PID_FILE"
acejuice-pulse --socket --newline &
printf "%s\n" "$!" >> "$PID_FILE"
acejuice-interval --socket &
printf "%s\n" "$!" >> "$PID_FILE"
acejuice | /usr/bin/lemonbar -p
printf "%s\n" "$!" >> "$PID_FILE"