Turning the brightness completely down
Solution 1:
Since you have said that the dbus
method is fine, that what I will post, plus some extra.
There is a way to turn off the screen through dbus
service:
qdbus com.canonical.Unity /com/canonical/Unity/Session com.canonical.Unity.Session.ActivateScreenSaver/
There is also a way to programmatically alter brightness to lowest setting, namely
qdbus org.gnome.SettingsDaemon.Power /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage 0
The value 0 at the end is to set the brightness to lowest percentage, but it could be anything , an unsigned integer.
Thanks to this answer , there is also another approach:
xset dpms force off
I suggest you bind the xset dpms force off
and xset dpms force on
to two shortcuts on the keyboard, because this turns off the screen, it does not act as screen saver, so you will need methods to turn on and off the screen at will.
However,that may or may not work, depending on the graphics card. In my experience, with this command I can set one laptop with Intel graphics that I have to completely turn off the screen , but the other one with AMD doesn't completely turn off.
The less clean way is to find what is in your /sys/class/backlight/
directory, for instance I have the /sys/class/backlight/intel_backlight
with brightness
file in it. With root privilleges you can edit that file and set it to some value you like.
There is way to change brightness with xrandr
however that's a software solution - it does not actually decrease power delivered to the screen, hence I'll omit it here