-
-
Save djorborn/02363a376f25b4147de06e5a53647bcd to your computer and use it in GitHub Desktop.
Manually Change Brightness In Linux Script
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 | |
## Very simple way to change brightness without a utility. | |
## I made this to use with acpi event handlers and my laptop keyboard | |
## GNU General Public License | |
## dosborn at vivaldi dot net | |
# Variables | |
# brightness_dir= Direcotry containing the backlight file | |
brightness_dir=/sys/class/backlight/intel_backlight | |
# brightness_file= the file named brightness in that dir | |
brightness_file=$brightness_dir/brightness | |
# brightness= The contents of that file | |
brightness=$(cat $brightness_file) | |
# actual_brightness= the actual_brightness file | |
actual_brightness=$(cat $brightness_dir/actual_brightness) | |
# max_brightness= the contents of max_brightness | |
max_brightness=$(cat $brightness_dir/max_brightness) | |
# min_brightness= how low you want it to get | |
min_brightness=50 | |
# n= the change, how fast it goes up and down | |
n=50 | |
## If `brightness_push.sh up` is called then it will go up "n". and 'down' for down. | |
if [[ "$1" == "up" ]]; then | |
if (( $actual_brightness < $max_brightness )); then | |
echo $(dc -e "$actual_brightness $n + p") >> $brightness_file; | |
fi | |
else | |
if (( $actual_brightness > $min_brightness )); then | |
echo $(dc -e "$actual_brightness $n - p") >> $brightness_file; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment