Do not break stuff if pulseaudio is not available

Wrap pulse.get_address with pcall and notify Awesome if an error
occurred instead of breaking everything.
This commit is contained in:
Stefano Mazzucco 2016-09-17 23:37:14 +01:00
parent b66eed7394
commit dc52f1c58b
1 changed files with 7 additions and 1 deletions

View File

@ -45,7 +45,13 @@ local icon = {
muted = icon_theme .. "/audio-volume-muted-symbolic" .. icon_extension
}
local address = pulse.get_address()
local status, address = pcall(pulse.get_address)
if not status then
naughty.notify({title="Error while loading PulseAudio",
text=address,
preset=naughty.config.presets.critical})
return widget
end
pulse.listen_for_signal(address, "org.PulseAudio.Core1", "NewSink")
local watcher = ldbus.api.watch(address)