Created
August 30, 2017 03:54
-
-
Save teolandon/f6e9a3d6b584f7287b4f05d2a1d9b968 to your computer and use it in GitHub Desktop.
intel_backlight brightness control scripts.
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 | |
# Takes an input of a number, to subtract from the current brightness. | |
DIR=/sys/class/backlight/intel_backlight | |
LVL=$1 | |
MIN=100 | |
CURR=$(head -n 1 "$DIR/brightness") | |
NEW=$(($CURR-$LVL)) | |
if [ "$NEW" -lt "$MIN" ]; then | |
tee "$DIR/brightness" <<< $MIN > /dev/null | |
exit | |
else | |
tee "$DIR/brightness" <<< $NEW > /dev/null | |
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
#!/bin/bash | |
# My laptop's brightness control doesn't automatically work | |
# by itself, and xbacklight is looking in the wrong directory | |
# to change my backlight settings, so I quickly wrote up these | |
# scripts to bindsym them to my brightness control keys. Simple | |
# and clean. | |
# Make sure that whatever you're using to call them has sufficient | |
# perimissions. | |
# Takes an input of a number, to add to the current brightness. | |
DIR=/sys/class/backlight/intel_backlight | |
LVL=$1 | |
MAX=$(head -n 1 "$DIR/max_brightness") | |
CURR=$(head -n 1 "$DIR/brightness") | |
NEW=$(($LVL+$CURR)) | |
if [ "$NEW" -gt "$MAX" ]; then | |
tee "$DIR/brightness" <<< $NEW > /dev/null | |
exit | |
else | |
tee "$DIR/brightness" <<< $NEW > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment