status/volume: Use same icon for slider/top bar

Currently the icon in the top bar indicates the volume level, while
the icon next to the slider indicates the type of output (speaker
or headphone). The speaker- and volume icons are quite similar,
but different enough to feel inconsistent, so use the volume one
in both cases.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5940

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2505>
This commit is contained in:
Florian Müllner 2022-10-07 14:21:08 +02:00 committed by Marge Bot
parent 4e48f94e47
commit 2aa30f5a96

View File

@ -204,6 +204,7 @@ const StreamSlider = GObject.registerClass({
let muted = this._stream.is_muted; let muted = this._stream.is_muted;
this._changeSlider(muted this._changeSlider(muted
? 0 : this._stream.volume / this._control.get_vol_max_norm()); ? 0 : this._stream.volume / this._control.get_vol_max_norm());
this._updateIcon();
this.emit('stream-updated'); this.emit('stream-updated');
} }
@ -217,6 +218,10 @@ const StreamSlider = GObject.registerClass({
this._updateVolume(); this._updateVolume();
} }
_updateIcon() {
this.iconName = this.getIcon();
}
getIcon() { getIcon() {
if (!this._stream) if (!this._stream)
return null; return null;
@ -308,9 +313,13 @@ class OutputStreamSlider extends StreamSlider {
return; return;
this._hasHeadphones = hasHeadphones; this._hasHeadphones = hasHeadphones;
this._updateIcon();
}
_updateIcon() {
this.iconName = this._hasHeadphones this.iconName = this._hasHeadphones
? 'audio-headphones-symbolic' ? 'audio-headphones-symbolic'
: 'audio-speakers-symbolic'; : this.getIcon();
} }
}); });