mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-09 14:19:43 +00:00
use alsa to get volume level
This commit is contained in:
parent
e531b0b02a
commit
5418211665
1 changed files with 5 additions and 5 deletions
|
@ -6,14 +6,14 @@ VOLUME_ON_ICON=''
|
||||||
VOLUME_MUTED_ICON=''
|
VOLUME_MUTED_ICON=''
|
||||||
|
|
||||||
get_volume(){
|
get_volume(){
|
||||||
curStatus=$(pactl get-sink-mute @DEFAULT_SINK@)
|
#curStatus=$(pactl get-sink-mute @DEFAULT_SINK@)
|
||||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1)
|
volume=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master))
|
||||||
|
|
||||||
if [ "${curStatus}" = 'Mute: yes' ]
|
if [ "${curStatus}" = '0%' ]
|
||||||
then
|
then
|
||||||
echo "$VOLUME_MUTED_ICON $volume%"
|
echo "$VOLUME_MUTED_ICON $volume"
|
||||||
else
|
else
|
||||||
echo "$VOLUME_ON_ICON $volume%"
|
echo "$VOLUME_ON_ICON $volume"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue