Compare commits
2 Commits
a38d064439
...
4f91067458
Author | SHA1 | Date | |
---|---|---|---|
4f91067458 | |||
4a4cc52f1c |
@ -88,7 +88,7 @@
|
|||||||
separator_height = 2
|
separator_height = 2
|
||||||
|
|
||||||
# Padding between text and separator.
|
# Padding between text and separator.
|
||||||
padding = 8
|
padding = 4
|
||||||
|
|
||||||
# Horizontal padding.
|
# Horizontal padding.
|
||||||
horizontal_padding = 8
|
horizontal_padding = 8
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# You can call this script like this:
|
# You can call this script like this:
|
||||||
@ -8,45 +7,40 @@ set -euo pipefail
|
|||||||
# $./dunst-volume.sh mute
|
# $./dunst-volume.sh mute
|
||||||
|
|
||||||
get_volume() {
|
get_volume() {
|
||||||
amixer -D pulse get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
|
amixer -D pipewire get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
|
||||||
}
|
}
|
||||||
|
|
||||||
is_mute() {
|
is_mute() {
|
||||||
amixer -D pulse get Master | grep '%' | grep -oE '[^ ]+$' | grep off >/dev/null
|
amixer -D pipewire get Master | grep '%' | grep -oE '[^ ]+$' | grep off >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
# Make the bar with the special character ─ (it's not dash -)
|
volume=$(get_volume)
|
||||||
# https://en.wikipedia.org/wiki/Box-drawing_character
|
|
||||||
#bar=$(seq -s "─" $(($volume / 5)) | sed 's/[0-9]//g')
|
|
||||||
# Send the notification
|
# Send the notification
|
||||||
#dunstify -i audio-volume-high -r 2593 -a volume-script "$volume $bar "
|
dunstify -i audio-volume-high -r 2593 -a volume-script -h int:value:$volume "Volume - ${volume}%"
|
||||||
dunstify -i audio-volume-high -a volume-script -h int:value:$volume "Volume"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
volume=$(get_volume)
|
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
up)
|
up)
|
||||||
send_notification
|
|
||||||
# Set the volume on (if it was muted)
|
# Set the volume on (if it was muted)
|
||||||
amixer -D pipewire set Master on >/dev/null
|
amixer -D pipewire set Master on >/dev/null
|
||||||
# Up the volume (+ 5%)
|
# Up the volume (+ 5%)
|
||||||
amixer -D pipewire sset Master 5%+ >/dev/null
|
amixer -D pipewire sset Master 5%+ >/dev/null
|
||||||
|
send_notification
|
||||||
;;
|
;;
|
||||||
down)
|
down)
|
||||||
send_notification
|
|
||||||
amixer -D pipewire set Master on >/dev/null
|
amixer -D pipewire set Master on >/dev/null
|
||||||
amixer -D pipewire sset Master 5%- >/dev/null
|
amixer -D pipewire sset Master 5%- >/dev/null
|
||||||
|
send_notification
|
||||||
;;
|
;;
|
||||||
mute)
|
mute)
|
||||||
|
# Toggle mute
|
||||||
|
amixer -D pipewire set Master 1+ toggle >/dev/null
|
||||||
if is_mute; then
|
if is_mute; then
|
||||||
dunstify -i audio-volume-muted -a volume-script -h int:value:$volume "Mute"
|
volume=$(get_volume)
|
||||||
|
dunstify -i audio-volume-muted -r 2593 -a volume-script -h int:value:$volume "Mute"
|
||||||
else
|
else
|
||||||
send_notification
|
send_notification
|
||||||
fi
|
fi
|
||||||
# Toggle mute
|
|
||||||
amixer -D pipewire set Master 1+ toggle >/dev/null
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user