Skip to content

Instantly share code, notes, and snippets.

@OrangeTux
Created November 17, 2014 21:10
Show Gist options
  • Save OrangeTux/8c6805de37b8c2534822 to your computer and use it in GitHub Desktop.
Save OrangeTux/8c6805de37b8c2534822 to your computer and use it in GitHub Desktop.
Increase or decrease brightness of screen.
#!/usr/bin/env bash
#
# Increase or decrease brightness of screen.
#
# Example usage:
#
# $ edit_brightness -50
# $ edit_brightness 10
#
# Make sure /sys/class/backlight/radeaon_b10/brightness is writable. This can
# be done add the folowing line to crontab file of root:
#
# @reboot chmod o+w /sys/class/backlight/radeon_bl0/brightness
#
set -e
SYS_PATH="/sys/class/backlight/radeon_bl0"
CUR_BRIGHTNESS=$(cat "$SYS_PATH/actual_brightness")
NEW_BRIGHTNESS=$(($CUR_BRIGHTNESS + $1))
echo $NEW_BRIGHTNESS | tee "$SYS_PATH/brightness" &> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment