Dunst add volume and brightness notifications

main
Guus van Meerveld 2 years ago
parent 5dbc30f4d4
commit 71c9b5470b
Signed by: Guusvanmeerveld
GPG Key ID: 2BA7D7912771966E

@ -1,13 +1,10 @@
Privacy Pass|ajhmfdgkijocedmfjonnpjfojldioehi
DuckDuckGo Privacy Essentials|bkdgflcldnnnapblkhphbgpggdiikppg
Magister Auto-Login|cekhhgcjpkahghpgeafhmkkjhidodplk
uBlock Origin|cjpalhdlnbpafiamejdnhcphjbkeiagm
Dark Reader|eimadpbcbfnmbkopoojfekhnkhdbieeh
I don't care about cookies|fihnjjcciajhdojfnbdddfaoknhalnja
NordVPN — #1 VPN Chrome Extension: Get a VPN|fjoaledfpmneenckfbpdfhkmimnjocfa
React Developer Tools|fmkadmapgofadopljbjfkapdkoienihi
JSON Viewer|gbmdgpbipfallnflgajpaliibnhdgobh
Return YouTube Dislike|gebbhagfogifgggkldgodflihgfeippi
GNOME Shell integration|gphhapmejobijbbhgpjhcjognlahblep
SponsorBlock for YouTube - Skip Sponsorships|mnjggcdmjocbbbhaepdhchncahnbgone
User JavaScript and CSS|nbhcbdghjpllgmfilhnhkllmkecfmpld
Bitwarden - Free Password Manager|nngceckbapebfimnlniiiahkandclblb
Chromium Web Store|ocaahdebbfolfmndjeplogmgcagdmblk|https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates.xml
Chromium Web Store|ocaahdebbfolfmndjeplogmgcagdmblk|https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates.xml
PDF Viewer|oemmndcbldboiebfnladdacbdfmadadm

@ -4,7 +4,7 @@
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
monitor = 1
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
@ -17,7 +17,7 @@
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = mouse
# follow = mouse
### Geometry ###
@ -89,7 +89,7 @@
frame_width = 1
# Defines color of the frame around the notification window.
frame_color = "#474747"
frame_color = "#282828"
# Define a color for the separator.
# possible values are:
@ -196,7 +196,7 @@
max_icon_size = 48
# Paths to default icons.
icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/
### History ###
@ -299,7 +299,7 @@
#default_icon = /path/to/icon
[urgency_normal]
background = "#285577"
background = "#222222"
foreground = "#ffffff"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
@ -313,6 +313,9 @@
# Icon for notifications with critical urgency, uncomment to enable
#default_icon = /path/to/icon
[chvolume]
ignore_history = yes
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
#

@ -27,19 +27,19 @@ XF86AudioNext
playerctl next
XF86AudioLowerVolume
pactl set-sink-volume @DEFAULT_SINK@ -3%
chvolume -5%
XF86AudioRaiseVolume
pactl set-sink-volume @DEFAULT_SINK@ +3%
chvolume +5%
XF86AudioMute
pactl set-sink-mute @DEFAULT_SINK@ toggle
chvolume +0% toggle
XF86MonBrightnessUp
light -A 5
chlight -A 5
XF86MonBrightnessDown
light -U 5
chlight -U 5
# make sxhkd reload its configuration files:
super + Escape

@ -11,3 +11,6 @@
/bin/dotfiles: dotfiles
/usr/share/icons/default/index.theme: config/cursors.theme
/usr/bin/chvolume: scripts/chvolume
/usr/bin/chlight: scripts/chlight

@ -0,0 +1,11 @@
#!/bin/bash
# chlight
msgTag="brightness-updater"
light "$@"
brightness="$(light -G)"
dunstify -a "chlight" -u low -i display-brightness -h string:x-dunst-stack-tag:$msgTag \
-h int:value:"$brightness" "Brightness: ${brightness}%"

@ -0,0 +1,23 @@
#!/bin/bash
# chvolume
# Arbitrary but unique message tag
msgTag="volume-updater"
pactl set-sink-volume @DEFAULT_SINK@ "$1"
pactl set-sink-mute @DEFAULT_SINK@ "$2"
volume="$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/[^0-9]*//g')"
mute="$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')"
if [[ $volume == 0 || "$mute" == "yes" ]]; then
# Show the sound muted notification
dunstify -a "chvolume" -u low -i audio-volume-muted -h string:x-dunst-stack-tag:$msgTag "Volume muted"
else
# Show the volume notification
dunstify -a "chvolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag \
-h int:value:"$volume" "Volume: ${volume}%"
fi
canberra-gtk-play -i audio-volume-change -d "chvolume"