From 888cd2481c629719c1e42286561755f15ac59a6f Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 9 Feb 2023 13:13:18 +0100 Subject: [PATCH] clean up volume notification --- .config/dunst/dunstrc | 6 ++++++ .local/bin/pamixer-notify | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 1e4639fb5..33bd6da7c 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -4,6 +4,7 @@ width = 370 height = 370 offset = 5x24 + gap_size = 4 transparency = 10 font = Monospace 12 format = "%s\n%b" @@ -15,11 +16,16 @@ markup = full icon_theme = Qogir-dark icon_path = /usr/share/icons/Qogir-dark/16/panel/ + dmenu = /usr/local/bin/dmenu -p dunst + mouse_left = context + middle = close_all + mouse_right = close_current [urgency_low] background = "#1a1b26" foreground = "#c0caf5" highlight = "#7aa2f7" + history_ignore = true timeout = 3 [urgency_normal] diff --git a/.local/bin/pamixer-notify b/.local/bin/pamixer-notify index 0b81b2138..574c8e387 100755 --- a/.local/bin/pamixer-notify +++ b/.local/bin/pamixer-notify @@ -9,11 +9,7 @@ pamixer "$@" >/dev/null # Query amixer for the current volume and whether or not the speaker is muted volume="$(pamixer --get-volume)" -if [ "$volume" -gt "100" ]; then - urgency="critical" -else - urgency="low" -fi +[ "$volume" -gt "100" ] && highlight="#ff768e" || highlight="#7aa2f7" if [ "$volume" -gt "70" ]; then icon="audio-volume-high" @@ -25,10 +21,12 @@ fi mute="$(pamixer --get-mute)" if [ "$volume" = 0 ] || [ "$mute" = "true" ]; then - notify-send -a "changeVolume" -i "audio-volume-muted" -u $urgency -h string:x-dunst-stack-tag:$msgTag "Volume muted" + notify-send -a "changeVolume" -i "audio-volume-muted" -u low -h string:x-dunst-stack-tag:$msgTag "Volume muted" else - notify-send -a "changeVolume" -i "$icon" -u $urgency -h string:x-dunst-stack-tag:$msgTag \ - -h int:value:"$volume" "Volume: ${volume}%" + notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%"\ + -h string:x-dunst-stack-tag:$msgTag \ + -h int:value:$volume \ + -h string:hlcolor:$highlight fi # Play the volume changed sound