From 92af781033f05c1d3f9cff4be150551da0ed2818 Mon Sep 17 00:00:00 2001 From: "jeffydc.xyz" Date: Tue, 30 Jun 2026 01:43:38 +0800 Subject: [PATCH] fix(audio_osd): use percent to check volume icon --- src/shell/osd/audio_osd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shell/osd/audio_osd.cpp b/src/shell/osd/audio_osd.cpp index f5e438c68c..e7483d3b28 100644 --- a/src/shell/osd/audio_osd.cpp +++ b/src/shell/osd/audio_osd.cpp @@ -15,11 +15,11 @@ namespace { [[nodiscard]] bool volumeChanged(float a, float b) { return std::abs(a - b) > kVolumeChangeEpsilon; } - const char* volumeIconName(float volume, bool muted) { - if (muted || volume <= 0.0f) { + const char* volumeIconName(int percent, bool muted) { + if (muted || percent <= 0) { return "volume-mute"; } - if (volume < 0.4f) { + if (percent < 40) { return "volume-low"; } return "volume-high"; @@ -29,7 +29,7 @@ namespace { const int percent = static_cast(std::round(std::max(0.0f, volume) * 100.0f)); return OsdContent{ .kind = OsdKind::Volume, - .icon = volumeIconName(volume, muted), + .icon = volumeIconName(percent, muted), .value = std::to_string(percent) + "%", .progress = std::clamp(volume, 0.0f, 1.0f), .overLimit = percent > 100,