Commits

Jhonny5 committed b091929

Added Volume and Battery status

  • Participants
  • Parent commits 9b4c337

Comments (0)

Files changed (2)

 CLEAR_COLOR='^fg()'
 X=0
 Y=1060
-HEIGHT=13
+HEIGHT=15
 WIDTH=1920
 FONT='-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*'
 
 
 getTemp() {
     icon 'temp'
-    CPU1_TEMP=`sensors | tail -n 7|head -n 1|awk '{print $3}'`
-    CPU2_TEMP=`sensors | tail -n 6|head -n 1|awk '{print $3}'`
+    CPU1_TEMP=`sensors|grep Core|awk 'NR==1 {print $3}'`
+    CPU2_TEMP=`sensors|grep Core|awk 'NR==2 {print $3}'`
     MB_TEMP=`sensors | tail -n 6 | sed -ne 's/MB Temperature: \+[-+]\([0-9]\+\).*/\1/p'`
     
     text 'Core 1: '
 }
 
 getVolume() {
-    VOLUME=`amixer sget $MIXER  | grep Mono\: | sed -e s/"  Mono: Playback [0-9]* \["// -e s/"\%.*"//`
+    VOLUME=`amixer sget $MIXER|grep "Front Left:"|awk '{print $5}'`
     VOLUME_ON=`amixer sget $MIXER | sed -ne 's/.*\ \[\([^]]*\).*/\1/p'`
 
     echo -n '^ca(1,~/scrpts/volumechanger.sh -t)'
     fi
     echo -n '^ca()'
 
-    echo -n "$VOLUME%"
+    echo -n "$VOLUME"
 }
 
 getMpd() {
     fi
 }
 
+#https://alderaan.archlinux.org/viewtopic.php?pid=1111830
+getBattery() {
+    icon 'battery'
+    STATUS=`cat /sys/class/power_supply/BAT0/status`
+    if [ "$STATUS" == "Discharging" ]; then
+        echo -ne "Dis."
+        echo -ne $(acpi -b |awk '{print $4 " " $5}')
+    else 
+        echo -n $STATUS    
+    fi
+
+}
+
 while :; do
     getCpuload
     getTemp
     getNet
     #getWeather
     #getMail
-    #getVolume
+    getVolume
+    getBattery
     #getMpd
 
     echo ''

dzen2/xbm/battery.xbm

+#define battery_width 16
+#define battery_height 16
+static unsigned char battery_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0xfc, 0x11,
+   0xfc, 0x71, 0xfc, 0x71, 0xfc, 0x71, 0xfc, 0x11, 0xfc, 0x1f, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};