Skip to content

Instantly share code, notes, and snippets.

@cabrinha
Last active November 11, 2015 06:20
Show Gist options
  • Save cabrinha/58d08cead9d364d91dc2 to your computer and use it in GitHub Desktop.
Save cabrinha/58d08cead9d364d91dc2 to your computer and use it in GitHub Desktop.
#!/bin/bash
PANEL_FIFO=/tmp/bar.fifo
PRINTER='/Users/yuppie/devel/bar/bin/printer.js'
NODE=/usr/local/bin/node
[ -e $PANEL_FIFO ] && rm "$PANEL_FIFO"
mkfifo $PANEL_FIFO
# Run bar and keep reading from fifo
#tail -n +1 -f $PANEL_FIFO | $NODE $PRINTER &
cat $PANEL_FIFO | node $PRINTER &
while :; do
date=`date "+%d %b - %I:%M %p"`
batt=`pmset -g batt | tail -n1 | awk '{print $2}' | sed s/\;//`
echo "S$batt $date" > $PANEL_FIFO
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment