status/volume: Mute/unmute when clicking icon
This behavior was lost with the move to quick settings. Now that we allow slider icons to be interactive, we can easily restore the feature (and even in a less-Easter-eggy way) https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5974 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2630>
This commit is contained in:
parent
7ee3514ddb
commit
10b5808f25
@ -32,7 +32,9 @@ const StreamSlider = GObject.registerClass({
|
|||||||
},
|
},
|
||||||
}, class StreamSlider extends QuickSlider {
|
}, class StreamSlider extends QuickSlider {
|
||||||
_init(control) {
|
_init(control) {
|
||||||
super._init();
|
super._init({
|
||||||
|
icon_reactive: true,
|
||||||
|
});
|
||||||
|
|
||||||
this._control = control;
|
this._control = control;
|
||||||
|
|
||||||
@ -54,6 +56,13 @@ const StreamSlider = GObject.registerClass({
|
|||||||
this._notifyVolumeChange();
|
this._notifyVolumeChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.connect('icon-clicked', () => {
|
||||||
|
if (!this._stream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._stream.change_is_muted(!this._stream.is_muted);
|
||||||
|
});
|
||||||
|
|
||||||
this._deviceItems = new Map();
|
this._deviceItems = new Map();
|
||||||
|
|
||||||
this._deviceSection = new PopupMenu.PopupMenuSection();
|
this._deviceSection = new PopupMenu.PopupMenuSection();
|
||||||
@ -204,6 +213,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.iconLabel = muted ? _('Unmute') : _('Mute');
|
||||||
this._updateIcon();
|
this._updateIcon();
|
||||||
this.emit('stream-updated');
|
this.emit('stream-updated');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user