#!/bin/sh set -e while [ $# -gt 0 ] ; do case "$1" in "--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 ;; *) printf "Parameter not recognized. Aborting...\n" exit 1 ;; esac shift done __send_cmd () { if [ -n "$NPIPE_OUT" ]; then printf "%s %s\n" "$1" "$2" > "$NPIPE_OUT" else printf "%s %s\n" "$1" "$2" fi } cycle=0 while true; do if [ $((cycle%4)) = 0 ]; then __send_cmd ":SET netw" "$($HOME/.config/screen/bin/netinfo.sh --color lemonbar --icon nerd)" __send_cmd ":SET cput" "$($HOME/.config/screen/bin/cputemp.sh --color lemonbar --icon nerd --unit)" fi if [ $((cycle%4)) = 0 ]; then __send_cmd ":SET date" "$(date +'%a %d %b %H:%M')" fi if [ $((cycle%16)) = 0 ]; then __send_cmd ":SET batt" "$($HOME/.config/screen/bin/battery.sh --color lemonbar --unit --icon nerd --symbols ascii)" fi cycle=$((cycle+1)) if [ $cycle = 1024 ]; then cycle=0 fi sleep 1 done