Created
September 5, 2023 16:09
-
-
Save notquitethereyet/75909bbcdf1e09f18552443b2f863db6 to your computer and use it in GitHub Desktop.
backlight and brightness control on X11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage=" | |
Asus Keyboard Brightness Control | |
================================ | |
Usage : | |
Increase : ./asus_kbd_light.sh up | |
Decrease : ./asus_kbd_light.sh down | |
Maximum : 3 | |
Minimum : 0 | |
" | |
user_inp=$1 | |
if [[ $user_inp != "up" ]] && [[ $user_inp != "down" ]] | |
then | |
echo "$usage" | |
else | |
: | |
fi | |
file_path=/sys/class/leds/asus::kbd_backlight/brightness | |
current=$(cat $file_path) | |
if [[ $user_inp == up ]] && [[ $current != 3 ]] | |
then | |
new_b=$(($current + 1)) | |
echo $new_b > $file_path | |
elif [[ $user_inp == down ]] && [[ $current != 0 ]] | |
then | |
new_b=$(($current - 1)) | |
echo $new_b > $file_path | |
else | |
: | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Multimedia keys | |
XF86AudioRaiseVolume | |
amixer -q set Master 5%+ unmute | |
# Still multimedia | |
XF86AudioLowerVolume | |
amixer -q set Master 5%- unmute | |
# still | |
XF86AudioMute | |
amixer -D pulse sset Master toggle-mute | |
# amixer -q set Master toggle | |
# Simple amixer command seems to have problems unmuting device | |
XF86MonBrightnessUp | |
brightnessctl -c backlight set +5% | |
XF86MonBrightnessDown | |
brightnessctl -c backlight set 5%- | |
XF86KbdBrightnessDown | |
~/.config/bspwm/scripts/asus_kbd_light.sh down | |
XF86KbdBrightnessUp | |
~/.config/bspwm/scripts/asus_kbd_light.sh up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment