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({ const SpeakerPercentLabel = params => Label({
...params, ...params,
connections: [[Audio, label => { connections: [[Audio, label => {
if (!Audio.speaker) if (Audio.speaker) {
return; label.label = Math.round(Audio.speaker.volume * 100) + '%';
let vol = Math.floor(Audio.speaker.volume * 100);
if (vol == 0) {
label.label = vol + '%';
}
else {
label.label = vol + 1 + '%';
} }
}, 'speaker-changed']], }, 'speaker-changed']],
}); });