Commit 6c8eb1a1 authored by Florian Müllner's avatar Florian Müllner

volume: Only emit sound feedback after volume changes

gnome-settings-daemon doesn't play the volume change sound when
the volume stayed the same (that is, it is already at its maximum
or minimum). This looks like the right thing to do, so copy its
behavior.

GNOME/gnome-shell#53
parent 5af8bf27
......@@ -113,6 +113,7 @@ var StreamSlider = class {
let value = this._slider.value;
let volume = value * this._control.get_vol_max_norm();
let prevMuted = this._stream.is_muted;
let prevVolume = this._stream.volume;
if (volume < 1) {
this._stream.volume = 0;
if (!prevMuted)
......@@ -124,7 +125,8 @@ var StreamSlider = class {
}
this._stream.push_volume();
if (!this._notifyVolumeChangeId && !this._inDrag) {
let volumeChanged = this._stream.volume !== prevVolume;
if (volumeChanged && !this._notifyVolumeChangeId && !this._inDrag) {
this._notifyVolumeChangeId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 30, () => {
this._notifyVolumeChange();
this._notifyVolumeChangeId = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment