Skip to content

Instantly share code, notes, and snippets.

@reliq
Last active January 17, 2019 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reliq/5095b5b0ca5a3be9e5cb8b1c0d74b97d to your computer and use it in GitHub Desktop.
Save reliq/5095b5b0ca5a3be9e5cb8b1c0d74b97d to your computer and use it in GitHub Desktop.
Optimus (Dual Graphics) - Backlight Keys Workaround (Ubuntu/Linux Mint)

Adapted from here.

Get Fn F5/F6 working:

sudo emacs etc/default/grub

Change the following: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi="

sudo update-grub

reboot the system... Now the splash screen should show up.

Verify acpi commands with acpi_listen:

acpi_listen.

press Fn F5/F6. I got this:

video/brightnessdown BRTDN 00000087 00000000 K
video/brightnessup BRTUP 00000086 00000000 K

Add the event codes to acpi event:

sudo emacs /etc/acpi/events/asus-keyboard-backlight-down

event=video/brightnessdown BRTDN 00000087

sudo emacs /etc/acpi/events/asus-keyboard-backlight-up

event=video/brightnessup BRTUP 00000086

Confirm you can change backlight by (where xx is an integer):

echo xx | sudo tee /sys/class/backlight/intel_backlight/brightness

Add the link to the script:

sudo emacs /etc/acpi/asus-keyboard-backlight.sh

KEYS_DIR=/sys/class/backlight/intel_backlight

I also set value to 10 instead of 1, as it was just too slow:

# Get increment of x/10, this allows the brightness to map to the bar.
# If your bar somehow has other than 10 steps, just change the '10' here to the number of steps.
inc=$((MAX/10))
INCREMENT=${inc%.*}

if [ "$1" = down ]; then
  VAL=$((VAL-INCREMENT))
else
  VAL=$((VAL+INCREMENT))
fi

You'll need to restart acpid for it to take effect:

sudo service acpid restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment