diff options
author | Ricardo Salveti <rsalveti@rsalveti.net> | 2014-10-13 20:48:06 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2014-10-13 20:48:06 -0500 |
commit | 88956a3657cc0f0f8f76b2935a7ae46033d5c200 (patch) | |
tree | 149bec2dc97a879d2939058d78639e419854f0f5 /src/volume-control.vala | |
parent | 34caa4fae102de8d91cb6d21c0d5e6a7104c95da (diff) | |
download | ayatana-indicator-sound-88956a3657cc0f0f8f76b2935a7ae46033d5c200.tar.gz ayatana-indicator-sound-88956a3657cc0f0f8f76b2935a7ae46033d5c200.tar.bz2 ayatana-indicator-sound-88956a3657cc0f0f8f76b2935a7ae46033d5c200.zip |
Headphone detection
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r-- | src/volume-control.vala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala index e09f212..c9ba42c 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -70,6 +70,8 @@ public class VolumeControl : Object private double _account_service_volume = 0.0; private Notify.Notification _notification; + private bool _active_port_headphone = false; + public signal void volume_changed (double v); public signal void mic_volume_changed (double v); @@ -177,6 +179,19 @@ public class VolumeControl : Object this.notify_property ("is-playing"); } + /* Check if the current active port is headset/headphone */ + /* There is not easy way to check if the port is a headset/headphone besides + * checking for the port name. On touch (with the pulseaudio droid element) + * the headset/headphone port is called 'output-headset' and 'output-headphone'. + * On the desktop this is usually called 'analog-output-headphones' */ + if (i.active_port.name == "output-wired_headset" || + i.active_port.name == "output-wired_headphone" || + i.active_port.name == "analog-output-headphones") { + _active_port_headphone = true; + } else { + _active_port_headphone = false; + } + if (_pulse_use_stream_restore == false && _volume != volume_to_double (i.volume.max ())) { |