1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

show notifications on brightness/volume change

This commit is contained in:
Ryan Kes 2020-03-08 22:43:12 +01:00
parent 366e692599
commit 7d779dbf3f
3 changed files with 51 additions and 7 deletions

12
deadd/.local/bin/brightness Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
if [ "$1" == "inc" ]; then
xbacklight -inc 20
fi
if [ "$1" == "dec" ]; then
xbacklight -dec 20
fi
notify-send.py "Screen Brightness" "$(printf "%.0f\n" "$(xbacklight -get)")" \
--hint string:image-path:video-display boolean:transient:true \
--replaces-process "brightness-popup"

32
deadd/.local/bin/volume Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
if [ "$1" == "inc" ]; then
amixer -q sset Master 5%+
fi
if [ "$1" == "dec" ]; then
amixer -q sset Master 5%-
fi
if [ "$1" == "mute" ]; then
amixer -q sset Master toggle
fi
AMIXER=$(amixer sget Master)
VOLUME=$(echo "$AMIXER" | grep 'Mono:' | awk -F'[][]' '{ print $2 }' | tr -d "%")
MUTE=$(echo "$AMIXER" | grep -o '\[off\]' | tail -n 1)
if [ "$MUTE" == "[off]" ]; then
ICON=audio-volume-muted
elif [ "$VOLUME" -le 20 ]; then
ICON=audio-volume-low
elif [ "$VOLUME" -le 60 ]; then
ICON=audio-volume-medium
else
ICON=audio-volume-high
fi
notify-send.py "Volume" "$VOLUME/100" \
--hint string:image-path:$ICON boolean:transient:true \
--replaces-process "volume-popup"

View File

@ -8,17 +8,17 @@ Print
# Audio controls # Audio controls
XF86AudioRaiseVolume XF86AudioRaiseVolume
pactl set-sink-volume @DEFAULT_SINK@ +5% ~/.local/bin/volume inc
XF86AudioLowerVolume XF86AudioLowerVolume
pactl set-sink-volume @DEFAULT_SINK@ -5% ~/.local/bin/volume dec
XF86AudioMute XF86AudioMute
pactl set-sink-mute @DEFAULT_SINK@ toggle ~/.local/bin/volume mute
# Screen brightness controls # Screen brightness controls
XF86MonBrightnessUp XF86MonBrightnessUp
xbacklight -inc 20 ~/.local/bin/brightness inc
XF86MonBrightnessDown XF86MonBrightnessDown
xbacklight -dec 20 ~/.local/bin/brightness dec
# lock screen # lock screen
super + F1 super + F1