Created
June 24, 2017 14:32
-
-
Save manoelstilpen/9bb1b382a2c2a9ec7e9aaf9d2f97da92 to your computer and use it in GitHub Desktop.
Script for changing brightness in Linux based systems
This file contains hidden or 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 | |
# It's necessary give the correct permissions for the brightness file | |
# Verify the correct path to the brightness file on your pc | |
# Parameters: "inc" for increment and "dec" for decrement brightness | |
#get the current brightness | |
current=`cat /sys/class/backlight/intel_backlight/actual_brightness` | |
# sum or subtract 10 from current brightness | |
if [ "$1" == "inc" ]; then | |
current=$(expr $current + 10) | |
elif [ "$1" == "dec" ]; then | |
current=$(expr $current - 10) | |
fi | |
#save the current brightness | |
`echo $current > /sys/class/backlight/intel_backlight/brightness` |
Thanks for the script :)
You can also add this to your /etc/sudoers
<user> ALL= NOPASSWD: /usr/local/bin/<your-brightness-script>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Giving the correct permission:
sudo chown your_user /sys/class/backlight/intel_backlight/brightness
Example usage for increment brightness in 10 units:
./brightness.sh inc 10