I have a script in
/etc/acpi that runs when I close my laptop's lid.
It turns off the internal monitor. It does this by
export DISPLAY=:0 sudo -u toothrot xset dpms force off
This works fine, but it would be neater if it didn't depend on my being logged in as toothrot. Is there a way to do it directly from root, without reference to a particular X-session? I tried
# echo Off >/sys/class/drm/card0/card0-eDP-1/dpms
Note that setting the brightness to 0 will not do, since it doesn't save any power.