Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Depends: dzen2-xft-xpm-xinerama-svn && conky
- # Desc: dzen2 bar for XMonad, ran within xmonad.hs via spawnPipe
- #Layout
- BAR_H=9
- BIGBAR_W=65
- WIDTH_L=870
- WIDTH_R=410 #WIDTH_L + WIDTH_R = 1280
- HEIGHT=16
- X_POS_L=0
- X_POS_R=$WIDTH_L
- Y_POS=0
- #Colors and font
- CRIT="#99cc66"
- BAR_FG="#3475aa"
- BAR_BG="#363636"
- DZEN_FG="#9d9d9d"
- DZEN_FG2="#444444"
- DZEN_BG="#020202"
- COLOR_SEP=$DZEN_FG2
- FONT="-*-montecarlo-medium-r-normal-*-11-*-*-*-*-*-*-*"
- #Conky
- CONKYFILE="${HOME}/.config/conky/conkyrc"
- IFS='|'
- INTERVAL=1
- CPUTemp=0
- GPUTemp=0
- CPULoad0=0
- CPULoad1=0
- MpdInfo=0
- MpdRandom="Off"
- MpdRepeat="Off"
- printVolInfo() {
- Perc=$(amixer get Master | grep "Mono:" | awk '{print $4}' | tr -d '[]%')
- Mute=$(amixer get Master | grep "Mono:" | awk '{print $6}')
- echo -n "^fg($DZEN_FG2) VOL "
- if [[ $Mute == "[off]" ]]; then
- echo -n "$(echo $Perc | gdbar -fg $CRIT -bg $BAR_BG -h $BAR_H -w $BIGBAR_W -s o -ss 1 -sw 2 -nonl) "
- echo -n "^fg()off"
- else
- echo -n "$(echo $Perc | gdbar -fg $BAR_FG -bg $BAR_BG -h $BAR_H -w $BIGBAR_W -s o -ss 1 -sw 2 -nonl) "
- echo -n "^fg()${Perc}%"
- fi
- return
- }
- #printVolInfo() {
- # Perc=$(expr 4 \* $(ossmix vmix0-outvol | awk '{print $10}' | sed -e 's/.0//g')
- #}
- printVolInfo() {
- Perc=$(amixer get Master | grep "Mono:" | awk '{print $4}' | tr -d '[]%')
- Mute=$(amixer get Master | grep "Mono:" | awk '{print $6}')
- echo -n "^fg($DZEN_FG2) VOL "
- if [[ $Mute == "[off]" ]]; then
- echo -n "$(echo $Perc | gdbar -fg $CRIT -bg $BAR_BG -h $BAR_H -w $BIGBAR_W -s o -ss 1 -sw 2 -nonl) "
- echo -n "^fg()off"
- else
- echo -n "$(echo $Perc | gdbar -fg $BAR_FG -bg $BAR_BG -h $BAR_H -w $BIGBAR_W -s o -ss 1 -sw 2 -nonl) "
- echo -n "^fg()${Perc}%"
- fi
- return
- }
- printCPUInfo() {
- [[ $CPULoad0 -gt 70 ]] && CPULoad0="^fg($CRIT)$CPULoad0^fg()"
- [[ $CPULoad1 -gt 70 ]] && CPULoad1="^fg($CRIT)$CPULoad1^fg()"
- echo -n " ^fg($DZEN_FG2)CPU ^fg($BAR_FG)${CPULoad0}%^fg($DZEN_FG2)/^fg($BAR_FG)${CPULoad1}%"
- return
- }
- printTempInfo() {
- CPUTemp=$(acpi --thermal | awk '{print substr($4,0,2)}')
- GPUTemp=$(nvidia-settings -q gpucoretemp | grep 'Attribute' | awk '{print $4}' | tr -d '.')
- [[ $CPUTemp -gt 70 ]] && CPUTemp="^fg($CRIT)$CPUTemp^fg()"
- [[ $GPUTemp -gt 70 ]] && GPUTemp="^fg($CRIT)$GPUTemp^fg()"
- echo -n "^fg($DZEN_FG2)TEMP ^fg($BAR_FG)${CPUTemp}°^fg($DZEN_FG2)/^fg($BAR_FG)${GPUTemp}°"
- return
- }
- printMemInfo() {
- [[ $MemPerc -gt 70 ]] && CPUTemp="^fg($CRIT)$MemPerc^fg()"
- echo -n "^fg($DZEN_FG2)MEM ^fg($BAR_FG)${MemPerc}%"
- return
- }
- printDropBoxInfo() {
- DropboxON=$(ps -A | grep -c dropbox)
- if [[ $DropboxON == "0" ]]; then
- echo -n "^fg($DZEN_FG2)DROPBOX ^fg()Off"
- else
- echo -n "^fg($DZEN_FG2)DROPBOX ^fg($CRIT)On"
- fi
- return
- }
- printMpdInfo() {
- MPDON=$(ps -A | grep -c mpd)
- if [[ $MPDON == "0" ]]; then
- echo -n "^fg($DZEN_FG2)MPD ^fg()Off"
- else
- # if [[ $MpdRepeat -eq "(null)" ]]; then
- # echo -n "^fg($DZEN_FG2)MPD ^fg()Offline"
- # [[ $(ncmpcpp --now-playing | wc -l) == 1 ]] && echo -n " ^fg($DZEN_FG2)| ^fg($BAR_FG)$(ncmpcpp --now-playing "%a") ^fg($DZEN_FG2)- ^fg($BAR_FG)$(ncmpcpp --now-playing "%t") ^fg($DZEN_FG2)| ^fg()$(ncmpcpp --now-playing "%l")"
- # else
- [[ $MpdRepeat == "On" ]] && MpdRepeat="^fg($CRIT)$MpdRepeat^fg()"
- [[ $MpdRandom == "On" ]] && MpdRandom="^fg($CRIT)$MpdRandom^fg()"
- echo -n "^fg($DZEN_FG2)REPEAT ^fg()$MpdRepeat ^fg($DZEN_FG2)| RANDOM ^fg()$MpdRandom ^fg($DZEN_FG2)| MPD $MpdInfo"
- # fi
- fi
- return
- }
- printDateInfo() {
- echo -n "^fg()$(date '+%Y^fg(#444).^fg()%m^fg(#444).^fg()%d^fg(#3475aa)/^fg(#444444)%a ^fg(#363636)| ^fg()%H^fg(#444):^fg()%M^fg(#444):^fg()%S') "
- return
- }
- printSpace() {
- echo -n " ^fg($COLOR_SEP)|^fg() "
- return
- }
- printLeft() {
- while true; do
- read CPULoad0 CPULoad1 CPUFreq MemUsed MemPerc MpdInfo MpdRandom MpdRepeat
- printVolInfo
- printSpace
- printDropBoxInfo
- printSpace
- printMpdInfo
- echo -n " ^fg()>^fg($BAR_FG)>^fg($DZEN_FG2)>"
- echo
- done
- return
- }
- printRight() {
- while true; do
- read CPULoad0 CPULoad1 CPUFreq MemUsed MemPerc MpdInfo MpdRandom MpdRepeat
- printCPUInfo
- printSpace
- printMemInfo
- printSpace
- printTempInfo
- printSpace
- printDateInfo
- echo
- done
- return
- }
- #Print all and pipe into dzen
- conky -c $CONKYFILE -u $INTERVAL | printLeft | dzen2 -x $X_POS_L -y $Y_POS -w $WIDTH_L -h $HEIGHT -fn $FONT -ta 'l' -bg $DZEN_BG -fg $DZEN_FG -p -e '' &
- conky -c $CONKYFILE -u $INTERVAL | printRight | dzen2 -x $X_POS_R -y $Y_POS -w $WIDTH_R -h $HEIGHT -fn $FONT -ta 'r' -bg $DZEN_BG -fg $DZEN_FG -p -e ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement