volume: Show overamplified icon when in overdrive
Show an overamplified volume icon if volume is louder the max normalized one. Use a similar logic as gnome-settings-daemon to delimit values, restricted to output. The purpose is to help users remember that visiting some websites or using some apps can get LOUD. https://bugzilla.gnome.org/show_bug.cgi?id=790280.
This commit is contained in:
parent
ddd4fd9c24
commit
6217c3b88d
@ -158,17 +158,24 @@ var StreamSlider = new Lang.Class({
|
|||||||
if (!this._stream)
|
if (!this._stream)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
let icons = ["audio-volume-muted-symbolic",
|
||||||
|
"audio-volume-low-symbolic",
|
||||||
|
"audio-volume-medium-symbolic",
|
||||||
|
"audio-volume-high-symbolic",
|
||||||
|
"audio-volume-overamplified-symbolic"];
|
||||||
|
|
||||||
let volume = this._stream.volume;
|
let volume = this._stream.volume;
|
||||||
|
let n;
|
||||||
if (this._stream.is_muted || volume <= 0) {
|
if (this._stream.is_muted || volume <= 0) {
|
||||||
return 'audio-volume-muted-symbolic';
|
n = 0;
|
||||||
} else {
|
} else {
|
||||||
let n = Math.floor(3 * volume / this._control.get_vol_max_norm()) + 1;
|
n = Math.ceil(3 * volume / this._control.get_vol_max_norm());
|
||||||
if (n < 2)
|
if (n < 1)
|
||||||
return 'audio-volume-low-symbolic';
|
n = 1;
|
||||||
if (n >= 3)
|
else if (n > 3)
|
||||||
return 'audio-volume-high-symbolic';
|
n = 4;
|
||||||
return 'audio-volume-medium-symbolic';
|
|
||||||
}
|
}
|
||||||
|
return icons[n];
|
||||||
},
|
},
|
||||||
|
|
||||||
getLevel() {
|
getLevel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user