Skip to content

Instantly share code, notes, and snippets.

@zoranzaric
Created May 26, 2011 10:01
Show Gist options
  • Save zoranzaric/992870 to your computer and use it in GitHub Desktop.
Save zoranzaric/992870 to your computer and use it in GitHub Desktop.
#!/bin/zsh
#Colors
DEFAULT='\#d4d4d4\'
RED='\#ff0000\'
GREEN='\#00ff00\'
BLUE='\#0000ff\'
BATTERY_PERCENT_BEFORE=0
while (true); do
BALL='\i[1000;3;16;16;/home/zz/Downloads/sport_soccer.png]\'
# Load {{{
LOAD_VAL=$(cat /proc/loadavg | cut -d " " -f 1)
LOAD="| L: $LOAD_VAL "
#}}}
# Battery {{{
BATTERY_PERCENT=$(acpitool -b | cut -d" " -f11 | sed "s/,//" | sed "s/%//")
BATTERY_CHARGING=$(acpitool -b | cut -d" " -f10 | sed "s/,//")
case $BATTERY_CHARGING in
"discharging")
if [[ $BATTERY_PERCENT > 20 ]]; then
BATTERY_COLOR=$DEFAULT
else
BATTERY_COLOR=$RED
fi
;;
"charging")
BATTERY_COLOR=$GREEN
;;
"charged")
BATTERY_COLOR=$BLUE
;;
*)
BATTERY_COLOR=$DEFAULT
;;
esac
BATTERY=""
BATTERY="| $BATTERY_COLOR$BATTERY_PERCENT%$DEFAULT "
#if [ $BATTERY_PERCENT_BEFORE > 50 ]; then
#if [ $BATTERY_PERCENT < 50 ]; then
#osd_cat -b percentage -P $BATTERY_PERCENT -A center -p middle --text Battery: --font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
#fi
#fi
BATTERY_PERCENT_BEFORE=$BATTERY_PERCENT
#}}}
# Date {{{
DATE=$(date +"| %a %d.%m.%y %H:%M ")
#}}}
# Temp {{{
#TEMP_VAL=$(cat /proc/acpi/thermal_zone/THM0/temperature | cut -d" " -f14)
TEMP=""
#TEMP="| $TEMP_VAL°C "
#}}}
# Backup {{{
BACKUP=""
if [[ -e /home/zz/.backup.lock ]]; then
BACKUP="$RED BACKUP$DEFAULT | "
fi
#}}}
# Mail {{{
MAIL="Mail: "
if [[ "$(ls ~/Mail/[email protected]/INBOX/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}zz${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}tb${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}z2k${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}january${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}Thinxx${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX.bup-list/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}bup${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX.redo-list/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}redo${DEFAULT} "
fi
if [[ "$(ls ~/Mail/[email protected]/INBOX.shinken-devel/new)" != "" ]]; then
MAIL="${MAIL}${GREEN}shinken${DEFAULT} "
fi
# Mail }}}
# MPD {{{
#MPD=$(mpc | head -n 1)
#if [[ "$MPD" != "" ]]; then
# VOL=$(mpc volume | cut -d":" -f2 | sed "s/^[ ]//" | cut -d" " -f1)
# MPD="| $MPD ($VOL) "
#fi
MPD=""
#}}}
wmfs -s "$BACKUP$MAIL$MPD$LOAD$TEMP$BATTERY$DATE"
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment