|
|
@ -13,6 +13,15 @@ while [ $# -gt 0 ] ; do |
|
|
|
"--no-value") |
|
|
|
"--no-value") |
|
|
|
no_value=1 |
|
|
|
no_value=1 |
|
|
|
;; |
|
|
|
;; |
|
|
|
|
|
|
|
"--socket") |
|
|
|
|
|
|
|
_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 |
|
|
|
|
|
|
|
;; |
|
|
|
"--icon") |
|
|
|
"--icon") |
|
|
|
case $2 in |
|
|
|
case $2 in |
|
|
|
"ascii"|""|"--"*) |
|
|
|
"ascii"|""|"--"*) |
|
|
@ -114,14 +123,34 @@ __send(){ |
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
printf ":SET audi %b%s%s%s%s%b%s" "${color}" "${icon}" "${status}" "${lvl}" "${unitsymbol}" "${colend}${colbgend}" "${sep}" |
|
|
|
if [ -n "$NPIPE_OUT" ]; then |
|
|
|
|
|
|
|
printf ":SET audi %b%s%s%s%s%b%s" "${color}" "${icon}" "${status}" "${lvl}" "${unitsymbol}" "${colend}${colbgend}" "${sep}" > "$NPIPE_OUT" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
printf ":SET audi %b%s%s%s%s%b%s" "${color}" "${icon}" "${status}" "${lvl}" "${unitsymbol}" "${colend}${colbgend}" "${sep}" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
[ "$newline" = 1 ] && printf "\n" || : |
|
|
|
if [ "$newline" = 1 ]; then |
|
|
|
|
|
|
|
if [ -n "$NPIPE_OUT" ]; then |
|
|
|
|
|
|
|
printf "\n" > "$NPIPE_OUT" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
printf "\n" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if [ -t 0 ]; then |
|
|
|
if [ -t 0 ]; then |
|
|
|
printf "running interactivelly" |
|
|
|
_pipe_dir="${XDG_RUNTIME_DIR:-/tmp/$(id -u)-runtime}/acejuice" |
|
|
|
|
|
|
|
mkdir -p "$_pipe_dir" |
|
|
|
|
|
|
|
NPIPE_IN="$_pipe_dir/acejuice-pulse.sock" |
|
|
|
|
|
|
|
unset _pipe_dir |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! mkfifo "$NPIPE_IN" 2> /dev/null; then |
|
|
|
|
|
|
|
printf "fifo '%s' already present\n" "$NPIPE_IN" >&2 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
while read -r line ; do |
|
|
|
|
|
|
|
__send $line |
|
|
|
|
|
|
|
done < "$NPIPE_IN" |
|
|
|
else |
|
|
|
else |
|
|
|
while read -r line ; do |
|
|
|
while read -r line ; do |
|
|
|
__send $line |
|
|
|
__send $line |
|
|
|