Advertisement
hu6

dwmstatus

hu6
Jun 14th, 2013
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. FONT='-artwiz-cure-medium-r-normal--11-110-75-75-p-90-iso8859-1'
  4.  
  5.  
  6. #WORKING
  7. getCpuload() {
  8. cpuuser=$(top -l 1| awk '/CPU usage/ {print $3}')
  9. cpusys=$(top -l 1| awk '/CPU usage/ {print $5}')
  10. cpuidle=$(top -l 1| awk '/CPU usage/ {print $7}')
  11.  
  12. rcpuuser=$(echo "$cpuuser" | awk '{printf "%.0f\n", $1}')
  13. rcpusys=$(echo "$cpusys" | awk '{printf "%.0f\n", $1}')
  14. rcpuidle=$(echo "$cpuidle" | awk '{printf "%.0f\n", $1}')
  15.  
  16. echo "\x07\x01 $rcpuuser%|$rcpusys%|$rcpuidle%"
  17. #echo "\x07\x01 CPU: "
  18.  
  19. }
  20.  
  21. #WORKING
  22. getTemp() {
  23. 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>//')
  24. ##temp=`weather -t`
  25. ##cond=`weather -c`
  26. ##fTemp=`echo ${temp:0:2}`
  27. strL=${#weather}
  28. finalS=`echo ${weather:1:$strL}`
  29. if (( "$fTemp" > "85" )); then
  30. #echo "\x04‚\x01 $cond, $temp "
  31. echo "\x04‚\x01 $finalS "
  32. elif (( "$fTemp" < "85" && "$fTemp" > "50" )); then
  33. #echo "\x05‚\x01 $cond, $temp "
  34. echo "\x05‚\x01 $finalS "
  35. else
  36. #echo "\x07‚\x01 $cond, $temp "
  37. echo "\x07‚\x01 $finalS "
  38. fi
  39. }
  40.  
  41. #WORKING
  42. getFs() {
  43. USED=`df -h | awk '/disk/ {print $3}'`
  44. TOTAL=`df -h | awk '/disk/ {print $2}'`
  45. PERC=`df -h | awk '/disk/ {print $5}'`
  46. tString=${#PERC}
  47. strL=`echo $tString`
  48. tPERC=`echo ${PERC:0:strL-1}`
  49.  
  50. if (( "$tPERC" > "75" )); then
  51. echo " \x06” \x01$USED/$TOTAL[\x06$PERC\x01] "
  52. elif (( "$tPERC" < "75" && "$tPERC" > "25" )); then
  53. echo " \x05” \x01$USED/$TOTAL[\x05$PERC\x01] "
  54. else
  55. echo " \x03” \x01$USED/$TOTAL[\x03$PERC\x01] "
  56. fi
  57. }
  58.  
  59. #WORKING
  60. getVolume() {
  61. VOLUME=`osascript -e "set cureVolume to output volume of (get volume settings)"`
  62. if (( "$VOLUME" > "75" )); then
  63. echo "\x04\x01 $VOLUME%"
  64. elif (( "$VOLUME" < "75" && "$VOLUME" > "25" )); then
  65. echo "\x05\x01 $VOLUME%"
  66. else
  67. echo "\x06\x01 $VOLUME%"
  68. fi
  69. }
  70.  
  71. #WORKING
  72. getMpd() {
  73. current=$(mpc current)
  74. time=`mpc | grep playing | awk '{ print $3 }'`
  75. paused=`mpc | awk '/paused/ {print $1}'`
  76. playing=`mpc | awk '/playing/ {print $1}'`
  77. #str=$(echo "`mpc | grep playing | awk '{ print $2 }' | wc -l`")
  78. #strL=${#str}
  79. #finalS=`echo ${str:7:$strL}`
  80.  
  81. if [ "$paused" = "[paused]" ]; then
  82. echo "\x05\x01 Music \x05Paused"
  83. elif [ "$playing" = "[playing]" ]; then
  84. echo "\x04Ž\x01 $current [$time]"
  85. else
  86. echo "\x06\x01 Music \x06Stopped"
  87. fi
  88. }
  89.  
  90. #WORKING
  91. getDate() {
  92. date_command=$(date +"%A, %B %d %Y - %I:%M:%S %p")
  93. echo "\x07\x01 $date_command "
  94.  
  95. }
  96.  
  97. #WORKING
  98. getBattery() {
  99. mString=`pmset -g batt | awk '/-InternalBattery-0/ {print $2}'`
  100. tString=${#mString}
  101. strL=`echo $tString`
  102. result=$[$strL - 1]
  103. finalS=`echo ${mString:0:$result}`
  104. finalS2=`echo ${mString:0:$result-1}`
  105.  
  106. if (( "$finalS2" > "75" )); then
  107. echo "\x04˜\x01 $finalS "
  108. elif (( "$finalS2" > "25" && "$finalS2" < "75" )); then
  109. echo "\x05˜\x01 $finalS "
  110. else
  111. echo "\x06˜\x01 $finalS "
  112. fi
  113. }
  114.  
  115. #WORKING
  116. getMail() {
  117. #USERNAME="username"
  118. #PASSWORD="password"
  119. mail_count=`curl -s https://$USERNAME:[email protected]/mail/feed/atom | sed -n '/^<fullcount>\([0-9]*\)<\/fullcount>$/s//\1/p'`
  120. if (( "$mail_count" < "1" )); then
  121. echo "\x04 Œ\x01 $mail_count Unread "
  122. elif (( "$mail_count" > "0" && "$mail_count" < "50" )); then
  123. echo "\x05 Œ\x01 $mail_count Unread "
  124. else
  125. echo "\x06 Œ\x01 $mail_count Unread "
  126. fi
  127. }
  128.  
  129. 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