From 5beb57b8e60358934357889d8b579a6d59f0d803 Mon Sep 17 00:00:00 2001 From: Roman Sokolkov Date: Sat, 4 Feb 2017 11:58:04 +0100 Subject: Added mute detection for volume widget --- volume-widget/volume.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'volume-widget/volume.lua') diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index c403dfd..bdbf134 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -21,14 +21,16 @@ volume_widget = wibox.widget { watch( 'amixer -D pulse sget Master', 1, function(widget, stdout, stderr, reason, exit_code) + local mute = string.match(stdout, "%[(o%D%D?)%]") local volume = string.match(stdout, "(%d?%d?%d)%%") volume = tonumber(string.format("% 3d", volume)) local volume_icon_name - if (volume >= 0 and volume < 25) then volume_icon_name="audio-volume-muted-symbolic" + if mute == "off" then volume_icon_name="audio-volume-muted-symbolic" + elseif (volume >= 0 and volume < 25) then volume_icon_name="audio-volume-muted-symbolic" elseif (volume >= 25 and volume < 50) then volume_icon_name="audio-volume-low-symbolic" elseif (volume >= 50 and volume < 75) then volume_icon_name="audio-volume-medium-symbolic" elseif (volume >= 75 and volume <= 100) then volume_icon_name="audio-volume-high-symbolic" end volume_widget.image = path_to_icons .. volume_icon_name .. ".svg" end -) \ No newline at end of file +) -- cgit v1.2.3