fix: round volume values properly

This commit is contained in:
matt1432 2023-09-13 01:11:11 -04:00
parent e6d2e891d7
commit 30c2c51828

View file

@ -35,16 +35,8 @@ const SpeakerIndicator = params => Icon({
const SpeakerPercentLabel = params => Label({
...params,
connections: [[Audio, label => {
if (!Audio.speaker)
return;
let vol = Math.floor(Audio.speaker.volume * 100);
if (vol == 0) {
label.label = vol + '%';
}
else {
label.label = vol + 1 + '%';
if (Audio.speaker) {
label.label = Math.round(Audio.speaker.volume * 100) + '%';
}
}, 'speaker-changed']],
});