I am try to make a program that control the bright of Linux OS, but I need to know how to control the monitor backlight just using terminal commands? I need to be able to increase, decrease. And also dim screen (and return undo dim) if it is possible too.
There are many possibilities. Just to name a few:
1.Bare echo
echo 8 > /sys/class/backlight/intel_backlight/brightness
For this to work, the user must be in the video
group.
Look at /sys/class/backlight/intel_backlight/max_brightness
to see what maximum brightness is supported.
2.The simplest to use
Install xbacklight
package and then try
xbacklight -inc 20 # increase backlight by 20%
xbacklight -dec 30 # decrease by 30%
xbacklight -set 80 # set to 80% of max value
xbacklight -get # get the current level
3.Over sophisticated
Run xrandr --verbose
and look for a line with resolution like LVDS1 connected 1024x600+0+0
. The name of your display (LVDS1 in this example) is needed here. Now you are ready to set brightness
xrandr --output LVDS1 --brightness 0.4
But this sets only software, not hardware brightness so you can exceed the limits (in both directons). Don't expect beautiful results but if you are brave enough to experiment a little bit then fasten your seatbelt and run
xrandr --output LVDS1 --brightness 1.7
xrandr --output LVDS1 --brightness -0.4 #yes, negative value is possible
xrandr --output LVDS1 --brightness 1
You can torture more your display with xrandr, but be ready to reboot your computer if something goes wrong. For example play with the following
xrandr --output LVDS1 --reflect x
xrandr --output LVDS1 --reflect xy
xrandr --output LVDS1 --reflect normal # return to normal state
xrandr --output LVDS1 --rotate left
xrandr --output LVDS1 --rotate inverted
xrandr --output LVDS1 --rotate normal # again, back to normal