mirror of https://github.com/lcpz/lain.git
add .device for pulseaudio and pulsebar; wiki updated; closes #323
This commit is contained in:
parent
26acf37707
commit
a5d68067cf
|
@ -19,12 +19,13 @@ local string = { gmatch = string.gmatch,
|
||||||
local function factory(args)
|
local function factory(args)
|
||||||
local pulseaudio = { widget = wibox.widget.textbox() }
|
local pulseaudio = { widget = wibox.widget.textbox() }
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
local devicetype = args.devicetype or "sink"
|
|
||||||
local timeout = args.timeout or 5
|
local timeout = args.timeout or 5
|
||||||
local settings = args.settings or function() end
|
local settings = args.settings or function() end
|
||||||
local scallback = args.scallback
|
local scallback = args.scallback
|
||||||
|
|
||||||
pulseaudio.cmd = args.cmd or "pacmd list-" .. devicetype .. "s | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
|
pulseaudio.device = "N/A"
|
||||||
|
pulseaudio.devicetype = args.devicetype or "sink"
|
||||||
|
pulseaudio.cmd = args.cmd or "pacmd list-" .. pulseaudio.devicetype .. "s | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
|
||||||
|
|
||||||
function pulseaudio.update()
|
function pulseaudio.update()
|
||||||
if scallback then pulseaudio.cmd = scallback() end
|
if scallback then pulseaudio.cmd = scallback() end
|
||||||
|
@ -37,6 +38,8 @@ local function factory(args)
|
||||||
muted = string.match(s, "muted: (%S+)") or "N/A"
|
muted = string.match(s, "muted: (%S+)") or "N/A"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pulseaudio.device = volume_now.index
|
||||||
|
|
||||||
local ch = 1
|
local ch = 1
|
||||||
volume_now.channel = {}
|
volume_now.channel = {}
|
||||||
for v in string.gmatch(s, ":.-(%d+)%%") do
|
for v in string.gmatch(s, ":.-(%d+)%%") do
|
||||||
|
|
|
@ -48,6 +48,7 @@ local function factory(args)
|
||||||
pulsebar.colors = args.colors or pulsebar.colors
|
pulsebar.colors = args.colors or pulsebar.colors
|
||||||
pulsebar.followtag = args.followtag or false
|
pulsebar.followtag = args.followtag or false
|
||||||
pulsebar.notifications = args.notification_preset
|
pulsebar.notifications = args.notification_preset
|
||||||
|
pulseaudio.device = "N/A"
|
||||||
|
|
||||||
if not pulsebar.notification_preset then
|
if not pulsebar.notification_preset then
|
||||||
pulsebar.notification_preset = {}
|
pulsebar.notification_preset = {}
|
||||||
|
@ -78,6 +79,8 @@ local function factory(args)
|
||||||
muted = string.match(s, "muted: (%S+)") or "N/A"
|
muted = string.match(s, "muted: (%S+)") or "N/A"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pulseaudio.device = volume_now.index
|
||||||
|
|
||||||
local ch = 1
|
local ch = 1
|
||||||
volume_now.channel = {}
|
volume_now.channel = {}
|
||||||
for v in string.gmatch(s, ":.-(%d+)%%") do
|
for v in string.gmatch(s, ":.-(%d+)%%") do
|
||||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
||||||
Subproject commit 9a0c9808e8054e5cc31d1293608f052a3b2d9f25
|
Subproject commit b1fd3487839584af9accc28a73a6aac7914d6b45
|
Loading…
Reference in New Issue