diff --git a/.config/dunst/volume-notification-hook.sh b/.config/dunst/volume-notification-hook.sh new file mode 100755 index 0000000..0617957 --- /dev/null +++ b/.config/dunst/volume-notification-hook.sh @@ -0,0 +1 @@ +#!/usr/bin/env sh diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index a428647..c6027b4 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -8,10 +8,10 @@ alt + ctrl + r dash $SCRIPTS/reboot.sh XF86AudioLowerVolume - amixer -q sset Master 5%- && dash $SCRIPTS/reset-dwmbar.sh + amixer -q sset Master 5%- && dash $SCRIPTS/reset-dwmbar.sh && dash $SCRIPTS/volume-notification.sh XF86AudioRaiseVolume - amixer -q sset Master 5%+ && dash $SCRIPTS/reset-dwmbar.sh + amixer -q sset Master 5%+ && dash $SCRIPTS/reset-dwmbar.sh && dash $SCRIPTS/volume-notification.sh XF86AudioStop player-command stop diff --git a/scripts/progress-bar.sh b/scripts/progress-bar.sh new file mode 100644 index 0000000..0b57b78 --- /dev/null +++ b/scripts/progress-bar.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +mod=$(echo "$1 % 8" | bc) +blocks=$(echo "$1 / 8" | bc) + +for _ in $(seq 1 "$blocks"); do + printf "█" +done + +case "$mod" in + 1) + printf "▏" + ;; + 2) + printf "▎" + ;; + 3) + printf "▍" + ;; + 4) + printf "▌" + ;; + 5) + [ "$1" -lt 96 ] && printf "▋" + ;; + 6) + [ "$1" -lt 96 ] && printf "▊" + ;; + 7) + [ "$1" -lt 96 ] && printf "▉" + ;; +esac diff --git a/scripts/volume-notification.sh b/scripts/volume-notification.sh new file mode 100644 index 0000000..36342df --- /dev/null +++ b/scripts/volume-notification.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + + +level=$(amixer get Master | grep -o "[0-9]*%\|\[on\]\|\[off\]" | + sed "s/\[on\]//;s/\[off\]//" | head -n 2) + +bar=$(echo "$level" | head -n 1 | tr '%' ' ' | + xargs dash "$SCRIPTS/progress-bar.sh") + +echo "$level" | xargs echo | + xargs -I{} notify-send -u low -t 3000 "Volume: {}" "$bar"