fix indentation

Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
This commit is contained in:
Jörg Thalheim 2015-02-22 11:19:24 +01:00 committed by Adrian C. (anrxc)
parent 340883180d
commit 9c535a19bd
1 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ local string = {
gmatch = string.gmatch gmatch = string.gmatch
} }
local math = { local math = {
floor = math.floor floor = math.floor
} }
-- }}} -- }}}
@ -29,15 +29,15 @@ local pulse = {}
-- {{{ Helper function -- {{{ Helper function
local function pacmd(args) local function pacmd(args)
local f = io.popen("pacmd "..args) local f = io.popen("pacmd "..args)
local line = f:read("*all") local line = f:read("*all")
f:close() f:close()
return line return line
end end
local function escape(text) local function escape(text)
local special_chars = { ["."] = "%.", ["-"] = "%-" } local special_chars = { ["."] = "%.", ["-"] = "%-" }
return text:gsub("[%.%-]", special_chars) return text:gsub("[%.%-]", special_chars)
end end
local cached_sinks = {} local cached_sinks = {}
@ -47,10 +47,10 @@ local function get_sink_name(sink)
local key = sink or 1 local key = sink or 1
-- Cache requests -- Cache requests
if not cached_sinks[key] then if not cached_sinks[key] then
local line = pacmd("list-sinks") local line = pacmd("list-sinks")
for s in string.gmatch(line, "name: <(.-)>") do for s in string.gmatch(line, "name: <(.-)>") do
table.insert(cached_sinks, s) table.insert(cached_sinks, s)
end end
end end
return cached_sinks[key] return cached_sinks[key]
@ -69,7 +69,7 @@ local function worker(format, sink)
-- If mute return 0 (not "Mute") so we don't break progressbars -- If mute return 0 (not "Mute") so we don't break progressbars
if string.find(data,"set%-sink%-mute "..escape(sink).." yes") then if string.find(data,"set%-sink%-mute "..escape(sink).." yes") then
return {0, "off"} return {0, "off"}
end end
local vol = tonumber(string.match(data, "set%-sink%-volume "..escape(sink).." (0x[%x]+)")) local vol = tonumber(string.match(data, "set%-sink%-volume "..escape(sink).." (0x[%x]+)"))