volume in bar
This commit is contained in:
parent
74e6cfec06
commit
c373245cbc
3 changed files with 39 additions and 3 deletions
|
|
@ -40,7 +40,7 @@ battery()
|
|||
|
||||
volume()
|
||||
{
|
||||
vol="$(amixer sget Master | awk -F"[][]" '/(Mono|Left):/ { print $2 }')"
|
||||
vol="$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oE '[1-9]+%' | head -n1)"
|
||||
echo "V vol: ${vol}"
|
||||
}
|
||||
|
||||
|
|
|
|||
36
files/.local/bin/vol
Executable file
36
files/.local/bin/vol
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
get_vol() {
|
||||
pactl get-sink-volume @DEFAULT_SINK@ | grep -oE -m 1 '[1-9]+%' | head -n1
|
||||
}
|
||||
|
||||
update_bar() {
|
||||
test -e /tmp/bar.fifo || return 0
|
||||
perc="$(get_vol)"
|
||||
echo "V vol: ${perc}" >> /tmp/bar.fifo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
+)
|
||||
pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
update_bar
|
||||
;;
|
||||
-)
|
||||
pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
update_bar
|
||||
;;
|
||||
.)
|
||||
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
;;
|
||||
!)
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
;;
|
||||
*)
|
||||
{
|
||||
echo "usage: $0 +/-/./!"
|
||||
echo ". to toggle output"
|
||||
echo "! to toggle mic"
|
||||
} >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue