diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-02 21:48:05 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-02 21:59:06 +0200 |
commit | 3b170a24fff0fa90bda5ac5c317946cfe864e795 (patch) | |
tree | a62540afcdfe410c0cf25c19b51d6cdd0e728c43 | |
parent | 73e50e95946788357dcfc8e7b75fa3ef482ce8d9 (diff) | |
download | vicious-legacy-3b170a24fff0fa90bda5ac5c317946cfe864e795.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...
-rw-r--r-- | thermal.lua | 2 | ||||
-rw-r--r-- | volume.lua | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/thermal.lua b/thermal.lua index 5c39884..7f31a52 100644 --- a/thermal.lua +++ b/thermal.lua @@ -18,7 +18,7 @@ local function worker(format, thermal_zone) -- Get an ACPI thermal zone local f = io.open("/proc/acpi/thermal_zone/" .. thermal_zone .. "/temperature") -- Fix your ACPI setup, or find another source of temperature - -- exposed trough /sys, if a thermal_zone can't be found. + -- exposed trough /sys, if a thermal_zone can't be found if not f then return {"N/A"} end local line = f:read("*line") f:close() @@ -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 |