Guest User

Untitled

a guest
Dec 16th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.31 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. IP="/home/zeus/.xmonad/icons/thayer"
  4. FONT="-*montecarlo-medium-r-normal-*-11-*-*-*-*-*-*"
  5. DZEN_BG="#161616"
  6. DZEN_FG="#9d9d9d"
  7. DZEN_FG2="#444444"
  8. DZEN_W="600"
  9. DZEN_H="16"
  10. DZEN_X="766"
  11. DZEN_Y="0"
  12. GFX_FG="#04c656"
  13. #0087cb
  14. GFX_BG="#363636"
  15. CRIT="#FF6600"
  16. GFX_H="9"
  17. GFX_W="65"
  18.  
  19. INTERVAL="1"
  20.  
  21. printBattery()
  22. {
  23.     BatPresent=$(acpi -b | wc -l)
  24.     ACPresent=$(acpi -a | grep -c on-line)
  25.     if [[ $BatPresent == "0" ]]; then
  26.         echo -n "^fg($DZEN_FG2)AC ^fg($GFX_FG)on ^fg($DZEN_FG2)BAT ^fg($GFX_FG)off"
  27.         return
  28.     else
  29.         RPERC=$(acpi -b | awk '{print $4}' | tr -d "%,")
  30.         echo -n " ^fg($DZEN_FG2)^i($IP/../bat_full_01.xbm) "
  31.         if [[ $ACPresent == "1" ]]; then
  32.             echo -n "$(echo $RPERC | gdbar -fg $GFX_FG -bg $GFX_BG -h $GFX_H -w $GFX_W -s o -ss 1 -sw 2 -nonl)"
  33.         else
  34.             echo -n "$(echo $RPERC | gdbar -fg $CRIT -bg $GFX_BG -h $GFX_H -w $GFX_W -s o -ss 1 -sw 2 -nonl)"
  35.         fi
  36.         echo -n " ^fg()$RPERC% "
  37.     fi
  38.     return
  39.  
  40. }
  41.  
  42. printVolume()
  43. {
  44.     Perc=$(amixer get Master | grep "Mono:" | awk '{print $4}' | tr -d '[]%')
  45.     Mute=$(amixer get Master | grep "Mono:" | awk '{print $6}')
  46.     echo -n " ^fg($DZEN_FG2)^i($IP/../spkr_01.xbm) "
  47.     if [[ $Mute == "[off]" ]]; then
  48.         echo -n "$(echo $Perc | gdbar -fg $CRIT -bg $GFX_BG -h $GFX_H -w $GFX_W -s o -ss 1 -sw 2 -nonl) "
  49.         echo -n "^fg()off"
  50.     else
  51.         echo -n "$(echo $Perc | gdbar -fg $GFX_FG -bg $GFX_BG -h $GFX_H -w $GFX_W -s o -ss 1 -sw 2 -nonl) "
  52.         echo -n "^fg()${Perc}% "
  53.     fi
  54.     return
  55. }
  56.  
  57. printWifi()
  58. {
  59.     WIFIDOWN=$(wicd-cli --wireless -d | wc -l)
  60.     WIFISIGNAL=0
  61.     echo -n "^fg($DZEN_FG2)^i($IP/../wifi_01.xbm) "
  62.     if [[ $WIFIDOWN -ne "1" ]]; then
  63.         WIFISIGNAL=$(wicd-cli --wireless -d | grep Quality | awk '{print $2}')
  64.         echo -n "$(echo $WIFISIGNAL | gdbar -fg $GFX_FG -bg $GFX_BG -h $GFX_H -w $GFX_W -s o -ss 1 -sw 2 -nonl) "
  65.         echo -n "^fg()$WIFISIGNAL% "
  66.     else
  67.         echo -n "^fg($CRIT)N/A "
  68.     fi
  69.     return
  70. }
  71.  
  72. printTime() {
  73.     echo -n " ^fg()$(date '+^fg()%A %d/%m ^fg(#44ddff)%H:%M')  "
  74.     return
  75. }
  76.  
  77.  
  78. printSep()
  79. {
  80.     echo -n "^fg($DZEN_FG2)|"
  81.     return
  82. }
  83.  
  84. #spkr_01.xbm
  85.  
  86. printBar()
  87. {
  88.     while true; do
  89.         printWifi
  90.         printSep
  91.         printBattery
  92.         printSep
  93.         printVolume
  94.         printSep
  95.         printTime
  96.         echo
  97.         sleep $INTERVAL
  98.     done
  99.     return
  100. }
  101.  
  102. printBar | dzen2 -x $DZEN_X -y $DZEN_Y -w $DZEN_W -h $DZEN_H -fn $FONT -ta 'r' -bg $DZEN_BG -fg $DZEN_FG -p -e ''
Advertisement
Add Comment
Please, Sign In to add comment