home/wm: add kb to change keybord brightness

This commit is contained in:
Dmitriy Pleshevskiy 2023-07-31 15:50:52 +03:00
parent d239274f0c
commit 85e625776a
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985
3 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
function SetKeyboardBrightness() {
echo $1 | sudo tee /sys/class/leds/asus\:\:kbd_backlight/brightness
}
min_brightness="0"
max_brightness=$(cat /sys/class/leds/asus\:\:kbd_backlight/max_brightness)
current_brightness=$(cat /sys/class/leds/asus\:\:kbd_backlight/brightness)
case "$1" in
"up")
if [ "$current_brightness" != "$max_brightness" ]; then
let 'current_brightness+=1'
fi
;;
"down")
if [ "$current_brightness" != "$bin_brightness" ]; then
let 'current_brightness-=1'
fi
;;
*)
echo "Usage: $0 {up|down}"
exit 1
;;
esac
SetKeyboardBrightness $current_brightness

View file

@ -27,6 +27,7 @@ let themeCfg = config.local.theme; in
inherit (themeCfg.window) activeBorder inactiveBorder; inherit (themeCfg.window) activeBorder inactiveBorder;
inherit (themeCfg.highlights) critical warning success; inherit (themeCfg.highlights) critical warning success;
inherit (themeCfg.syntax) mark1 mark2 mark3; inherit (themeCfg.syntax) mark1 mark2 mark3;
kdbBrightnessScriptPath = "${./scripts/kdb_brightness.sh}";
}; };
}; };

View file

@ -358,8 +358,12 @@ myKeys conf =
-- Change volume -- Change volume
("<XF86AudioMute>", spawn "amixer -q sset Master toggle"), ("<XF86AudioMute>", spawn "amixer -q sset Master toggle"),
("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 5%+"), ("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 5%+"),
("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 5%-") ("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 5%-"),
-- Change keyboard brightness
("<XF86KbdBrightnessUp>", spawn (kdbBrightness "up")),
("<XF86KbdBrightnessDown>", spawn (kdbBrightness "down"))
] ]
where kdbBrightness cmd = myTerminal ++ " -- @kdbBrightnessScriptPath@ " ++ cmd
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Mouse bindings: default actions bound to mouse events -- Mouse bindings: default actions bound to mouse events