Add support for volume keys
This commit is contained in:
parent
d6c4a0071d
commit
e718a248b9
3 changed files with 27 additions and 0 deletions
19
script/vol
Executable file
19
script/vol
Executable file
|
@ -0,0 +1,19 @@
|
|||
current=$(pactl get-sink-volume @DEFAULT_SINK@ | rg [0-9]+% -o | rg -o [0-9]+ | head -n 1)
|
||||
|
||||
case "$1" in
|
||||
"raise" ) {
|
||||
if [ $current -ge 95 ];
|
||||
then pactl set-sink-volume @DEFAULT_SINK@ 100%
|
||||
else pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
fi
|
||||
};;
|
||||
"lower" ) {
|
||||
if [ $current -le 5 ];
|
||||
then pactl set-sink-volume @DEFAULT_SINK@ 0%
|
||||
else pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
fi
|
||||
};;
|
||||
"toggle" ) {
|
||||
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
};;
|
||||
esac
|
|
@ -20,6 +20,8 @@ in {
|
|||
fira-code
|
||||
# GUI programs
|
||||
pavucontrol
|
||||
# We want `pactl` from the `pulseaudio` package
|
||||
pulseaudio
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ let mod = "Mod4";
|
|||
${slurp}/bin/slurp | ${grim}/bin/grim -g - - | ${wl-clipboard}/bin/wl-copy -t image/png
|
||||
'');
|
||||
|
||||
vol = ../../../script/vol;
|
||||
|
||||
in with lib; {
|
||||
|
||||
options.custom.gui.wm = with types; {
|
||||
|
@ -100,6 +102,10 @@ in with lib; {
|
|||
"${mod}+Alt+Tab" = "exec ${pkgs.google-chrome}/bin/google-chrome-stable --ozone-platform-hint=auto --enable-features=VaapiVideoDecoder,VaapiVideoEncoder";
|
||||
|
||||
"${mod}+Backspace" = "mode kill";
|
||||
|
||||
"XF86AudioRaiseVolume" = "exec ${vol} raise";
|
||||
"XF86AudioLowerVolume" = "exec ${vol} lower";
|
||||
"XF86AudioMute" = "exec ${vol} toggle";
|
||||
}
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue