Skip to content

Instantly share code, notes, and snippets.

@joshua-mcintosh
Created September 18, 2012 22:39
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 joshua-mcintosh/3746446 to your computer and use it in GitHub Desktop.
Save joshua-mcintosh/3746446 to your computer and use it in GitHub Desktop.
statnot shatus script
batt_stat() {
batt_perc=$(acpi -b |awk -e 'sub(/%/,"") { print $4 }' |sed -e 's/,//')
if acpi -b |egrep 'Charg|Full' >/dev/null
then
batt_sym="\x05"
elif [[ $batt_perc -lt 20 ]]
then
batt_sym="\x03 "
else
batt_sym="\x01 "
fi
echo -e "$batt_sym $batt_perc%";
}
int () {
host -R1 -W1 google.com >/dev/null &&
echo -e "\x05 ON\x01 " || echo -e "\x03 NO\x01"
}
if [ $# -eq 0 ]; then
byobu=" \x01 $(tmux list-windows -a|wc -l)"
int=$(int)
home="  $(df -P | sort -d | awk '/^\/dev\/sda7/{s=s (s?" ":"") $5} END {printf "%s", s}') "
mem="  $(awk '/^-/ {print $3}' <(free -mh)) "
batt="$(batt_stat)"
time="\x02  `date +'%F %R'`"
echo -e " $int $batt $byobu $mem $home $time ";
else
echo -e "^tw() ^fg(grey50)[`date +%R`] ^fg(yellow)MSG $( cut -c 1-20 <<< $1 )\n ^fg(grey50)[`date +'%R:%S'`] ^fg(yellow)notify^fg()> $1" > $HOME/.notify;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment