Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- FONT='-artwiz-cure-medium-r-normal--11-110-75-75-p-90-iso8859-1'
- #WORKING
- getCpuload() {
- cpuuser=$(top -l 1| awk '/CPU usage/ {print $3}')
- cpusys=$(top -l 1| awk '/CPU usage/ {print $5}')
- cpuidle=$(top -l 1| awk '/CPU usage/ {print $7}')
- rcpuuser=$(echo "$cpuuser" | awk '{printf "%.0f\n", $1}')
- rcpusys=$(echo "$cpusys" | awk '{printf "%.0f\n", $1}')
- rcpuidle=$(echo "$cpuidle" | awk '{printf "%.0f\n", $1}')
- echo "\x07\x01 $rcpuuser%|$rcpusys%|$rcpuidle%"
- #echo "\x07\x01 CPU: "
- }
- #WORKING
- getTemp() {
- weather=$(curl --silent "http://xml.weather.yahoo.com/forecastrss?p=20854&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//')
- ##temp=`weather -t`
- ##cond=`weather -c`
- ##fTemp=`echo ${temp:0:2}`
- strL=${#weather}
- finalS=`echo ${weather:1:$strL}`
- if (( "$fTemp" > "85" )); then
- #echo "\x04\x01 $cond, $temp "
- echo "\x04\x01 $finalS "
- elif (( "$fTemp" < "85" && "$fTemp" > "50" )); then
- #echo "\x05\x01 $cond, $temp "
- echo "\x05\x01 $finalS "
- else
- #echo "\x07\x01 $cond, $temp "
- echo "\x07\x01 $finalS "
- fi
- }
- #WORKING
- getFs() {
- USED=`df -h | awk '/disk/ {print $3}'`
- TOTAL=`df -h | awk '/disk/ {print $2}'`
- PERC=`df -h | awk '/disk/ {print $5}'`
- tString=${#PERC}
- strL=`echo $tString`
- tPERC=`echo ${PERC:0:strL-1}`
- if (( "$tPERC" > "75" )); then
- echo " \x06 \x01$USED/$TOTAL[\x06$PERC\x01] "
- elif (( "$tPERC" < "75" && "$tPERC" > "25" )); then
- echo " \x05 \x01$USED/$TOTAL[\x05$PERC\x01] "
- else
- echo " \x03 \x01$USED/$TOTAL[\x03$PERC\x01] "
- fi
- }
- #WORKING
- getVolume() {
- VOLUME=`osascript -e "set cureVolume to output volume of (get volume settings)"`
- if (( "$VOLUME" > "75" )); then
- echo "\x04\x01 $VOLUME%"
- elif (( "$VOLUME" < "75" && "$VOLUME" > "25" )); then
- echo "\x05\x01 $VOLUME%"
- else
- echo "\x06\x01 $VOLUME%"
- fi
- }
- #WORKING
- getMpd() {
- current=$(mpc current)
- time=`mpc | grep playing | awk '{ print $3 }'`
- paused=`mpc | awk '/paused/ {print $1}'`
- playing=`mpc | awk '/playing/ {print $1}'`
- #str=$(echo "`mpc | grep playing | awk '{ print $2 }' | wc -l`")
- #strL=${#str}
- #finalS=`echo ${str:7:$strL}`
- if [ "$paused" = "[paused]" ]; then
- echo "\x05\x01 Music \x05Paused"
- elif [ "$playing" = "[playing]" ]; then
- echo "\x04\x01 $current [$time]"
- else
- echo "\x06\x01 Music \x06Stopped"
- fi
- }
- #WORKING
- getDate() {
- date_command=$(date +"%A, %B %d %Y - %I:%M:%S %p")
- echo "\x07\x01 $date_command "
- }
- #WORKING
- getBattery() {
- mString=`pmset -g batt | awk '/-InternalBattery-0/ {print $2}'`
- tString=${#mString}
- strL=`echo $tString`
- result=$[$strL - 1]
- finalS=`echo ${mString:0:$result}`
- finalS2=`echo ${mString:0:$result-1}`
- if (( "$finalS2" > "75" )); then
- echo "\x04\x01 $finalS "
- elif (( "$finalS2" > "25" && "$finalS2" < "75" )); then
- echo "\x05\x01 $finalS "
- else
- echo "\x06\x01 $finalS "
- fi
- }
- #WORKING
- getMail() {
- #USERNAME="username"
- #PASSWORD="password"
- mail_count=`curl -s https://$USERNAME:[email protected]/mail/feed/atom | sed -n '/^<fullcount>\([0-9]*\)<\/fullcount>$/s//\1/p'`
- if (( "$mail_count" < "1" )); then
- echo "\x04 \x01 $mail_count Unread "
- elif (( "$mail_count" > "0" && "$mail_count" < "50" )); then
- echo "\x05 \x01 $mail_count Unread "
- else
- echo "\x06 \x01 $mail_count Unread "
- fi
- }
- xsetroot -name "$(getMpd)$(getVolume)$(getMail)$(getTemp)$(getBattery)$(getCpuload)$(getFs)$(getDate) $(echo "\x01") $(echo "\x02") $(echo "\x03") $(echo "\x04") $(echo "\x05") $(echo "\x06") $(echo "\x07") $(echo "\x08")"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement