Add notify-on-volume script for dunst volume notifications
This commit is contained in:
17
bin/notify-on-volume
Executable file
17
bin/notify-on-volume
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
msgId="991049"
|
||||||
|
|
||||||
|
volume=$(pamixer --get-volume)
|
||||||
|
mute=$(pamixer --get-mute)
|
||||||
|
|
||||||
|
if [[ $volume == 0 || "$mute" == "true" ]]; then
|
||||||
|
# Show the sound muted notification
|
||||||
|
dunstify -a "notify-on-volume" -u low -i audio-volume-muted -r "$msgId" "Volume muted"
|
||||||
|
else
|
||||||
|
# Show the volume notification
|
||||||
|
dunstify -a "notify-on-volume" -u low -i audio-volume-high -r "$msgId" \
|
||||||
|
-h int:value:"$volume" "Volume: ${volume}%"
|
||||||
|
fi
|
||||||
|
|
||||||
|
canberra-gtk-play -i audio-volume-change -d "notify-on-volume"
|
||||||
@@ -54,3 +54,7 @@ timeout = 0
|
|||||||
background = "#191e2a"
|
background = "#191e2a"
|
||||||
foreground = "#cbccc6"
|
foreground = "#cbccc6"
|
||||||
frame_color = "#ff3333"
|
frame_color = "#ff3333"
|
||||||
|
|
||||||
|
[volume]
|
||||||
|
appname = "notify-on-volume"
|
||||||
|
history_ignore=yes
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ exec_always --no-startup-id $HOME/dotfiles/bin/set-video-wallpaper
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Bind media keys on a keyboard to control volume and playback
|
# Bind media keys on a keyboard to control volume and playback
|
||||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 2
|
bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 2 && notify-on-volume
|
||||||
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 2
|
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 2 && notify-on-volume
|
||||||
bindsym XF86AudioMute exec --no-startup-id pamixer -t
|
bindsym XF86AudioMute exec --no-startup-id pamixer -t
|
||||||
bindsym XF86AudioPlay exec playerctl play-pause
|
bindsym XF86AudioPlay exec playerctl play-pause
|
||||||
bindsym XF86AudioNext exec playerctl next
|
bindsym XF86AudioNext exec playerctl next
|
||||||
|
|||||||
Reference in New Issue
Block a user