修复 awesome 启动时 pulse 音量显示 bug
This commit is contained in:
@@ -202,8 +202,11 @@ local volicon = wibox.widget.imagebox(theme.widget_vol)
|
|||||||
-- PulseAudio volume
|
-- PulseAudio volume
|
||||||
theme.volume = lain.widget.pulse({
|
theme.volume = lain.widget.pulse({
|
||||||
settings = function()
|
settings = function()
|
||||||
vlevel = volume_now.left .. "-" .. volume_now.right .. "%|" .. volume_now.device
|
vlevel = "N/A"
|
||||||
if volume_now.muted then
|
if volume_now then
|
||||||
|
vlevel = volume_now.left .. "-" .. volume_now.right .. "%|" .. volume_now.device
|
||||||
|
end
|
||||||
|
if volume_now and volume_now.muted then
|
||||||
vlevel = vlevel .. " M"
|
vlevel = vlevel .. " M"
|
||||||
end
|
end
|
||||||
widget:set_markup(markup.fontfg(theme.font, "#7493d2", vlevel))
|
widget:set_markup(markup.fontfg(theme.font, "#7493d2", vlevel))
|
||||||
|
|||||||
@@ -86,9 +86,12 @@ local function factory(args)
|
|||||||
function pulse.update()
|
function pulse.update()
|
||||||
helpers.async({ shell, "-c", type(pulse.cmd) == "string" and pulse.cmd or pulse.cmd() },
|
helpers.async({ shell, "-c", type(pulse.cmd) == "string" and pulse.cmd or pulse.cmd() },
|
||||||
function(s)
|
function(s)
|
||||||
volume_now = parse_sink(s)
|
if not s or #s == 0 then
|
||||||
|
volume_now = nil
|
||||||
pulse.device = volume_now.index
|
else
|
||||||
|
volume_now = parse_sink(s)
|
||||||
|
pulse.device = volume_now.index
|
||||||
|
end
|
||||||
|
|
||||||
widget = pulse.widget
|
widget = pulse.widget
|
||||||
settings()
|
settings()
|
||||||
|
|||||||
Reference in New Issue
Block a user