Skip to content

Instantly share code, notes, and snippets.

@tejzpr
Last active June 5, 2018 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tejzpr/08ca5449e8605ec7aff05d10db0dae5f to your computer and use it in GitHub Desktop.
Save tejzpr/08ca5449e8605ec7aff05d10db0dae5f to your computer and use it in GitHub Desktop.
Dim backlight in Intel Graphics based Laptops running Ubuntu 18.04 (Gnome or Budgie)
Open a terminal and run the following commands (cd to your home directory first)
sudo apt install xbacklight
xauth generate :0 . trusted
xauth add ${HOST}:0 . $(xxd -l 16 -p /dev/urandom)
sudo vi /etc/udev/rules.d/98-backlight.rules
Paste the following into the 98-backlight.rules
################################################# START ###################################
# Adjust screen brightness according to power state
# 1st rule for when on AC
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/USERNAME/.Xauthority", RUN+="/usr/bin/xbacklight -set 85"
# 2nd rule for when on battery
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/USERNAME/.Xauthority", RUN+="/usr/bin/xbacklight -set 30"
################################################# END ######################################
sudo vi /usr/share/X11/xorg.conf.d/20-intel.conf
Paste the following into 20-intel.conf
Section "Device"
Identifier "card0"
Driver "intel"
Option "Backlight" "intel_backlight"
BusID "PCI:0:2:0"
EndSection
~
REBOOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment