Skip to content

Commit

Permalink
cs_sound.py: Gracefully handle input streams that don't have a name,
Browse files Browse the repository at this point in the history
ignore streams created by sound effects and a11y utilities, and don't
add the same source id more than once.
  • Loading branch information
mtwebster committed Jul 18, 2018
1 parent cbb94ab commit 0cafeb6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,28 @@ def streamAdded(self, c, id):
stream = self.controller.lookup_stream_id(id)

if stream in self.controller.get_sink_inputs():
self.appList[id] = VolumeBar(self.controller.get_vol_max_norm(), 100, stream.props.name + ": ", stream.get_gicon())
name = stream.props.name

# FIXME: We use to filter out by PA_PROP_APPLICATION_ID. But
# most streams report this as null now... why??
if name in ("speech-dispatcher", "libcanberra"):
# speech-dispatcher: orca/speechd/spd-say
# libcanberra: cinnamon effects, test sounds
return

if id in self.appList.keys():
# Don't add an input more than once
return

if name == None:
name = _("Unknown")

label = "%s: " % name

self.appList[id] = VolumeBar(self.controller.get_vol_max_norm(),
100,
label,
stream.get_gicon())
self.appList[id].setStream(stream)
self.appSettings.add_row(self.appList[id])
self.appSettings.list_box.invalidate_headers()
Expand Down

0 comments on commit 0cafeb6

Please sign in to comment.