contrib: make pulse compatible with lua5.3

String.format does like converting float to hex (or int for that
matter). This fixes the issue

Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
This commit is contained in:
crondog 2015-07-24 15:08:18 +02:00 committed by Adrian C. (anrxc)
parent 56b353e773
commit 211a2bfcf5
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,8 @@ local string = {
gmatch = string.gmatch gmatch = string.gmatch
} }
local math = { local math = {
floor = math.floor floor = math.floor,
ceil = math.ceil
} }
-- }}} -- }}}
@ -99,6 +100,8 @@ function pulse.add(percent, sink)
if vol > 0x10000 then vol = 0x10000 end if vol > 0x10000 then vol = 0x10000 end
if vol < 0 then vol = 0 end if vol < 0 then vol = 0 end
vol = math.ceil(vol)
local cmd = string.format("pacmd set-sink-volume %s 0x%x >/dev/null", sink, vol) local cmd = string.format("pacmd set-sink-volume %s 0x%x >/dev/null", sink, vol)
return os.execute(cmd) return os.execute(cmd)
end end