26 lines
1.0 KiB
Bash
Executable File
26 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# changeVolume
|
|
|
|
dir=$(pwd)
|
|
|
|
# Arbitrary but unique message id
|
|
msgId="991049"
|
|
|
|
# Change the volume using alsa(might differ if you use pulseaudio)
|
|
amixer -c 0 set Master "$@" > /dev/null
|
|
|
|
# Query amixer for the current volume and whether or not the speaker is muted
|
|
volume="$(amixer -c 0 get Master | tail -1 | awk '{print $4}' | sed 's/[^0-9]*//g')"
|
|
mute="$(amixer -c 0 get Master | tail -1 | awk '{print $6}' | sed 's/[^a-z]*//g')"
|
|
if [[ $volume == 0 || "$mute" == "off" ]]; then
|
|
# Show the sound muted notification
|
|
#dunstify -a "changeVolume" -u low -i audio-volume-muted -r "$msgId" "Volume muted"
|
|
notify-send -a "changeVolume" -u low -i audio-volume-muted "Volume muted"
|
|
else
|
|
# Show the volume notification
|
|
#dunstify -a "changeVolume" -u low -i audio-volume-high -r "$msgId" \
|
|
#"Volume: ${volume}%" "$($(dir)/getProgressString 10 "<b> </b>" " " $volume)"
|
|
notify-send -a "changeVolume" -u low -i audio-volume-high \
|
|
"Volume: ${volume}%" "$($dir/getProgressString 10 " " "* " $volume)"
|
|
fi
|