gnome-shell-extension-bettervolume
gnome-shell-extension-bettervolume copied to clipboard
Unmute doesn't return to the pre-mute volume
When middle clicking to unmute, the volume changes from zero to seemingly the smallest value above zero.
I can't really reproduce the behavior you're describing. :
What version of Gnome are you using?
3.20.1 on Arch Linux
I got it to work, sort of. Mute toggling works now but I don't know how to stop the aggregateMenu from opening. Also, the first middle click does nothing because stream
is null
the first time for some reason...
const Gvc = imports.gi.Gvc;
// Each Gvc.MixerControl is a connection to PulseAudio,
// so it's better to make it a singleton
let _mixerControl;
function getMixerControl() {
if (_mixerControl)
return _mixerControl;
_mixerControl = new Gvc.MixerControl({ name: 'gnome-shell-extension-bettervolume Control' });
_mixerControl.open();
return _mixerControl;
}
let _previousVolumeValue, _previousVolumeIcon;
function _onVolumeIndicatorClick (actor, e) {
// When middle-clicking on the indicator we want to toggle mute
if (e.get_button() === Clutter.BUTTON_MIDDLE) {
let control = getMixerControl();
let stream = control.get_default_sink();
if (!stream) return;
stream.change_is_muted(stream && !stream.is_muted);
}
}
Based on https://github.com/GNOME/gnome-shell/blob/master/js/ui/status/volume.js