Skip to content

Instantly share code, notes, and snippets.

@kakwa
Last active May 31, 2016 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kakwa/36b43fa51ab7e84bf43b80e6acc39a36 to your computer and use it in GitHub Desktop.
Save kakwa/36b43fa51ab7e84bf43b80e6acc39a36 to your computer and use it in GitHub Desktop.
#!/bin/sh
get_state() {
f=`grep "flags" /proc/pmu/battery_0 | sed 's/.*:\ //'`
if [ $f -eq 00000011 ]
then
echo "<"
elif [ $f -eq 00000013 ]
then
echo ">"
else
echo "="
fi
}
get_time() {
d=`grep "time" /proc/pmu/battery_0 | sed 's/.*:\ //'`
date -d@$d -u +%H:%M:%S
}
while true
do
xsetroot -name "`get_state` `get_time` | `date +%d/%m/%y` `date +%H:%M`"
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment