EDIT: would be better say “blank” instead of "turn off" EDIT2: Seems not possible, due limits of xset and X11? :
I hooked a second monitor using the HDMI output.
Usually, when I wanted to turn off the laptop’s monitor (LVDS1), I used to have two methods:
close the laptop’s lid (in /etc/systemd/logind.conf I set HandleLidSwitch=ignore to do nothing: just turn off the screen: I can say it because as I almost close the lid, I can see that it simply turn off)
using a bash script wich contain: xset -display :0 dpms force off
Now that I have the second monitor on HDMI, the second method (xset -display :0 dpms force off) turn off both screens instead of only the laptop’s monitor.
I am aware of xrandr --output LVDS1 --off to turn off the laptop’s screen and of xrandr --output LVDS1 --auto to turn on the laptop’s screen, but doesn’t work as expected: was better using xset -display :0 dpms force off, because to reactivate it I just had to move the mouse or press any key on the keyboard; furthermore, the xrandr method, deactivate my screens layout (HDMI extended on the right). xset instead and again, didn’t deactivate the screens layout.
So, currently:
Closing the lid, works as expected and flawlessly but I would use a bash script (which I can call with keyboard schortcut, also when I am distant from the laptop, thanks to wireless keyboad).
Such script was xset -display :0 dpms force off but turn off both screens (but as I’ve said is enough to move mouse or press keyboard to reactivate)
xrandr --output LVDS1 --off doesn’t work as I would and like: deactivate screens layout and I can’t reactivate the screen using mouse and keyboard as instead xset does.
There is a method to have the same behaviour of lid closing using a bash script? Or maybe by changing the xset script?
Hi!
If you want to use a script, you can use xrandr option. You can make a script with a menu and the options you want, or make a script for any option. Then you can launch them with a shortcut. It’ll doesn’t matter if you can reactivate with the mouse , you’ll have a shortcut for that.
About the script, if you want a graphical menu you can read about kdialog(Qt) or dialog(Gtk), if you don’t, you can launch the menu in a terminal and choose any options with a key. Also you can use dmenu, it’s a menu for window managers but it’s in manjaro repos.
Here there’s one I have for that matter with dmenu
I edited /etc/UPower/UPower.conf by setting: IgnoreLid=true
xrandr is not an option, since as I’ve said, by turning off the screen (instead of blanking it as xset instead does) it deatcivate my screens layout:
I set the HDMI screen to be an extension to the right; as I run the xrandr command, ok: the laptop’s screen goes black but the HDMI screen become a mirror instead of an extension.
There is very probably an input device with the name “Lid Switch” that reports the state of the lid, systemd watches the events to react appropriately.
By the way, if you want to turn off only the integrated display, isn’t setting the brightness to zero a viable workaround?
Zero on some slider in the settings or zero in /sys/class/backlight/*/brightness? Because most of the time the settings application won’t let you go to the actual zero level. You can do that, however, by directly writing to the backlight class device’s brightness attribute.
As I try (also logged in as root in the terminal) I always got: Permission denied
This happens for /sys/class/drm/card0-LVDS-1/intel_backlight/brightness and also for /sys/class/drm/card0-LVDS-1/dpms.