Skip to content

Commit

Permalink
修复了音量在中文环境下一直显示静音的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Int-0X7FFFFFFF committed Mar 3, 2023
1 parent 0dc8173 commit 34bff56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions DEF/statusbar/packages/vol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ signal=$(echo "^s$this^" | sed 's/_//')

update() {
sink=$(pactl info | grep 'Default Sink' | awk '{print $3}')
[ "$sink" = "" ] && $(pactl info | grep '默认音频入口' | awk '{print $2}')
volunmuted=$(pactl list sinks | grep $sink -A 6 | sed -n '7p' | grep 'Mute: no')
vol_text=$(pactl list sinks | grep $sink -A 7 | sed -n '8p' | awk '{printf int($5)}')
if [ "$sink" = "" ]; then sink=$(pactl info | grep '默认音频入口' | awk -F'' '{print $2}');fi
volunmuted=$(pactl list sinks | grep $sink -A 6 | sed -n '7p' | grep '静音:否')
vol_text=$(pactl list sinks | grep $sink -A 7 | sed -n '8p' | awk '{printf int($4)}')
if [ "$LANG" != "zh_CN.UTF-8" ]; then
volunmuted=$(pactl list sinks | grep $sink -A 6 | sed -n '7p' | grep 'Mute: no')
vol_text=$(pactl list sinks | grep $sink -A 7 | sed -n '8p' | awk '{printf int($5)}')
fi
if [ ! "$volunmuted" ]; then vol_text="--"; vol_icon="";
elif [ "$vol_text" -eq 0 ]; then vol_text="00"; vol_icon="";
elif [ "$vol_text" -lt 10 ]; then vol_icon="奔"; vol_text=0$vol_text;
Expand Down

0 comments on commit 34bff56

Please sign in to comment.