Honor muted state on initialization and sink change

This commit is contained in:
Stefano Mazzucco 2017-05-25 22:07:53 +01:00
parent 5d9df5db5f
commit 8916e9a973
1 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ function widget:run_client()
v, found = line:gsub("^(NewSink:%s+)(/.*%w)", "%2") v, found = line:gsub("^(NewSink:%s+)(/.*%w)", "%2")
if found ~=0 then if found ~=0 then
self:update_sink(v) self:update_sink(v)
local volume = self.sink:get_volume_percent()[1] local volume = self.sink:is_muted() and "Muted" or self.sink:get_volume_percent()[1]
self:update_appearance(volume) self:update_appearance(volume)
widget.notify(volume) widget.notify(volume)
end end
@ -157,7 +157,7 @@ function widget:init()
local sink_path = assert(self.core:get_sinks()[1], "No sinks found") local sink_path = assert(self.core:get_sinks()[1], "No sinks found")
self:update_sink(sink_path) self:update_sink(sink_path)
local volume = self.sink:get_volume_percent()[1] local volume = self.sink:is_muted() and "Muted" or self.sink:get_volume_percent()[1]
self:update_appearance(volume) self:update_appearance(volume)
self:run_client() self:run_client()