home/wm: add kb to change keybord brightness
This commit is contained in:
parent
d239274f0c
commit
85e625776a
3 changed files with 36 additions and 1 deletions
30
home/modules/window_manager/scripts/kdb_brightness.sh
Executable file
30
home/modules/window_manager/scripts/kdb_brightness.sh
Executable 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
|
|
@ -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}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue