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:
parent
366e692599
commit
7d779dbf3f
12
deadd/.local/bin/brightness
Executable file
12
deadd/.local/bin/brightness
Executable 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
32
deadd/.local/bin/volume
Executable 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"
|
@ -8,17 +8,17 @@ Print
|
||||
|
||||
# Audio controls
|
||||
XF86AudioRaiseVolume
|
||||
pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
~/.local/bin/volume inc
|
||||
XF86AudioLowerVolume
|
||||
pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
~/.local/bin/volume dec
|
||||
XF86AudioMute
|
||||
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
~/.local/bin/volume mute
|
||||
|
||||
# Screen brightness controls
|
||||
XF86MonBrightnessUp
|
||||
xbacklight -inc 20
|
||||
XF86MonBrightnessDown
|
||||
xbacklight -dec 20
|
||||
XF86MonBrightnessUp
|
||||
~/.local/bin/brightness inc
|
||||
XF86MonBrightnessDown
|
||||
~/.local/bin/brightness dec
|
||||
|
||||
# lock screen
|
||||
super + F1
|
||||
|
Loading…
Reference in New Issue
Block a user