- Copy the script to the file
/usr/local/bin/save-and-restore-brightness.sh - Run the following command:
sudo chmod a+x /usr/local/bin/save-and-restore-brightness.sh - Append the following line to the file
/etc/pam.d/lightdm:session optional pam_exec.so /usr/local/bin/save-and-restore-brightness.sh
This script can be adapted to any laptop by adjusting the variables SCREEN_BRIGHTNESS_FILE and KEYBOARD_BRIGHTNESS_FILE.