dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit e2d7ea50017d4996d11ea66279529dc296b73076
parent 970c428abb6797fdd5091798cb3c1abfa3899737
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 23 Sep 2019 08:56:34 +0200

Read volume from pulsemixer or amixer

Diffstat:
M.local/bin/sysstatus | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.local/bin/sysstatus b/.local/bin/sysstatus @@ -5,7 +5,11 @@ battery=BAT0 mail=$(mailstatus | sed 's/^/ /;s/$/ |/;s/ |//') music=$(mpc status | sed 1q | sed 's/^volume:.*$//;s/^/ /;s/$/ |/;s/ |//') keymap=$(setxkbmap -print | sed -n '5s/^.*pc+//;5s/+.*$//;5p') -vol=$(pulsemixer --get-volume | cut -d' ' -f1) +if type pulsemixer >/dev/null 2>&1; then + vol="$(pulsemixer --get-volume | cut -d' ' -f1)%" +else + vol=$(amixer get Master | grep -o "[0-9]*%\|\[off\]") +fi cputemp=$(sensors | grep -n 'Core 0:' | awk '{print $3}') cpuload=$(cut -d' ' -f1 /proc/loadavg) if [ -d "/sys/class/power_supply/$battery" ]; then @@ -22,7 +26,7 @@ wlanquality=$(echo \ bc -l | sed 's/\..*$//') date=$(date +'%F %a %T') -status="${mail}${music} ${keymap} | ♪ ${vol}% | ${cputemp} ${cpuload}" +status="${mail}${music} ${keymap} | ♪ ${vol} | ${cputemp} ${cpuload}" [ ! "$battery" = "BAT0" ] && status="${status} | ${battery}" status="${status} | ${wlanssid} ${wlanquality}% | $date"