diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/service.vala | 8 | ||||
-rw-r--r-- | src/volume-control.vala | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/service.vala b/src/service.vala index fb56215..ba77ae8 100644 --- a/src/service.vala +++ b/src/service.vala @@ -270,6 +270,7 @@ public class IndicatorSound.Service: Object { private bool check_sync_notification = false; private bool support_sync_notification = false; + private string last_output_notification = "multimedia"; void update_sync_notification () { if (!check_sync_notification) { @@ -283,6 +284,13 @@ public class IndicatorSound.Service: Object { if (!support_sync_notification) return; + /* Suppress notifications of volume changes if it is because the + output stream changed. */ + var oldoutput = this.last_output_notification; + this.last_output_notification = this.volume_control.stream; + if (oldoutput != this.last_output_notification) + return; + var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction; if (shown_action != null && shown_action.get_state().get_boolean()) return; diff --git a/src/volume-control.vala b/src/volume-control.vala index bf97021..62cb2d0 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -54,6 +54,14 @@ public class VolumeControl : Object private bool _pulse_use_stream_restore = false; private uint32 _active_sink_input = -1; private string[] _valid_roles = {"multimedia", "alert", "alarm", "phone"}; + public string stream { + get { + if (_active_sink_input < 0 || _active_sink_input >= _valid_roles.length) + return "multimedia"; + else + return _valid_roles[_active_sink_input]; + } + } private string? _objp_role_multimedia = null; private string? _objp_role_alert = null; private string? _objp_role_alarm = null; |