aboutsummaryrefslogtreecommitdiff
path: root/volume.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-02 21:48:05 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-02 21:48:05 +0200
commit9d518b83a953f1913083531c8f840bc1e08d60ab (patch)
treea980adab0e9908be67a6f723f046764d056f1fb0 /volume.lua
parentddf9646b5eb8f016bb226a48112382cd6e5496f7 (diff)
downloadvicious-legacy-9d518b83a953f1913083531c8f840bc1e08d60ab.tar.xz
volume: added mute support
If a channel is muted we return 0. Something like "Muted" would be nice, but lets not break progressbars. If it doesn't concern you, then return what ever you want...
Diffstat (limited to 'volume.lua')
-rw-r--r--volume.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/volume.lua b/volume.lua
index 3e59f48..d02c79e 100644
--- a/volume.lua
+++ b/volume.lua
@@ -6,7 +6,10 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
-local string = { match = string.match }
+local string = {
+ find = string.find,
+ match = string.match
+}
-- }}}
@@ -22,9 +25,10 @@ local function worker(format, channel)
f:close()
local volume_level = string.match(mixer, "([%d]?[%d]?[%d])%%")
-
- -- Don't break progressbars
- if volume_level == nil then return {0} end
+ -- If muted return 0 (not "Mute") so we dont break progressbars
+ if string.find(mixer, "%[off%]") or volume_level == nil then
+ volume_level = 0
+ end
return {volume_level}
end