If you're a night owl just like me you might need much lower brightness than Ubuntu's minimum brightness (when using hotkeys) which is around 5% of your screen's max brightness. When using very bright backlit screens like mine even this 5% is just too much. So you have to lower it even more. But this is not possible ( well actually you can if you have time|patience|stupidity to fiddle with the brightness keys which most people don't ) with the hotkeys. You can use the system settings menu to lower it but come on that much trouble just to lower the brightness? Nah.. not something I'd do. So let's get to it.
What we have to do is to echo the brightness value we want to
(the intel_backlight part may vary)
So we could just do this,
or assign a shortcut to,
So is that it? Yes if you want to enter your password every damn time we want to change the brightness. We have to set the permissions of the file so that it will allow us to play with it. To do that we need to do,
But this permission change won't survive a reboot, so we need to add this to the /etc/rc.local so the permissions are set correct every time we reboot.
Do,
then above “exit 0” add,
then press CTRL+X and then enter “y” then exit.
Now you could assign a shortcut to,
What we have to do is to echo the brightness value we want to
/sys/class/backlight/intel_backlight/brightness
(the intel_backlight part may vary)
So we could just do this,
sudo echo 3 > /sys/class/backlight/intel_backlight/brightness
or assign a shortcut to,
pkexec echo 3 > /sys/class/backlight/intel_backlight/brightness
So is that it? Yes if you want to enter your password every damn time we want to change the brightness. We have to set the permissions of the file so that it will allow us to play with it. To do that we need to do,
sudo chmod 666 /sys/class/backlight/intel_backlight/brightness
#so evil isn't it?
But this permission change won't survive a reboot, so we need to add this to the /etc/rc.local so the permissions are set correct every time we reboot.
Do,
sudo nano /etc/rc.local
then above “exit 0” add,
chmod 666 /sys/class/backlight/intel_backlight/brightness
#no you don't need sudo
then press CTRL+X and then enter “y” then exit.
Now you could assign a shortcut to,
echo 3 > /sys/class/backlight/intel_backlight/brightness
And that's it, instant night mode.
NOTE: IF you don't want to 666 the file you could just create a new group, add you and root to that group, then own the file by root:group and 664 the file.
INFO: cat /sys/class/backlight/intel_backlight/max_brightness is your max brightness.
PS: Play with the values to get the right one. I'd recommend 1.
NOTE: IF you don't want to 666 the file you could just create a new group, add you and root to that group, then own the file by root:group and 664 the file.
INFO: cat /sys/class/backlight/intel_backlight/max_brightness is your max brightness.
PS: Play with the values to get the right one. I'd recommend 1.