Created
February 9, 2013 00:49
-
-
Save malko/4743260 to your computer and use it in GitHub Desktop.
Shell script for screen brightness setting of ASUS UX32 series under ubuntu 12.10
You can pass a step value as parameter, and should pass negative values to decrease brightness.
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/sh | |
# get user step on command line or default to 1 | |
USERSTEP=${1:-1} | |
# get max and current values of brightness | |
MAX=`/usr/lib/gnome-settings-daemon/gsd-backlight-helper --get-max-brightness` | |
CUR=`/usr/lib/gnome-settings-daemon/gsd-backlight-helper --get-brightness` | |
# define step and min to apply regarding the max value to have approximatively ten levels of settings | |
STEP=$(($MAX/10)) | |
MIN=$((STEP/2)) | |
# calc new user wanted value | |
NEW=$(($CUR+$USERSTEP*$STEP)) | |
if [ $NEW -gt $MAX ]; then | |
NEW=$MAX | |
fi | |
if [ $NEW -lt $MIN ]; then | |
NEW=$MIN | |
fi | |
# finally apply new setting and echo it | |
pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper --set-brightness $NEW | |
echo $NEW |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment