about summary refs log tree commit diff
path: root/scripts/dwm-status
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dwm-status')
-rwxr-xr-xscripts/dwm-status15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/dwm-status b/scripts/dwm-status
index 6996ae5..2569053 100755
--- a/scripts/dwm-status
+++ b/scripts/dwm-status
@@ -19,13 +19,20 @@ status() { \
 
 	# Get the volume of ALSA's master volume output.  Show an icon if or
 	# not muted.
-	amixer get Master | grep -o "[0-9]*%\|\[on\]\|\[off\]" | sed "s/\[on\]//;s/\[off\]//"
+	active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
+	curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
+	volume=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
+	if [ "${curStatus}" = 'yes' ]
+	then
+			echo " $volume%"
+	else
+			echo " $volume%"
+	fi
 
 	echo "$delim"
 
-	# Wifi quality percentage and  icon if ethernet is connected.
+	# Wifi quality percentage
 	grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70) "%" }'
-	sed "s/down//;s/up//" /sys/class/net/w*/operstate
 
 	# Show unread mail
 	command -v mw >/dev/null 2>&1 &&
@@ -63,5 +70,5 @@ while :; do
 	# Sleep for a minute after changing the status bar before updating it
 	# again. Note that the `refbar` "refreshes" the statusbar by killing
 	# this command. Feel free to change the time interval if you want.
-	sleep 1m
+	sleep 1s
 done