Turn off laptop display when plugged to an external monitor
I want to automatically turn off the laptop display when the laptop is plugged to an external monitor (i.e. use the external monitor as the only display). Often, I "dock" my work laptop onto my home setup and work on it using my main desktop monitor. How to best achieve this? I'm on Arch Linux.
Several related questions:
-
Setting the brightness to 0 is not the same as turning off the display completely, right? There might be implications in terms of disabling the display so that it uses no power at all vs. brightness "off" resulting in very little power usage but still using power nonetheless, for example.
-
It doesn't seem like DPMS is appropriate in this situation. So I scripted something with xrandr. Is there a better solution? Could it be added to a hook, e.g. a udev hook?
-
How do monitor names referred to by xrandr work, e.g. HDMI1, DP2, VIRTUAL1, etc.? I scripted something basic in the past involving the names and on rare occasions I needed to change the names used by the script as xrandr gave them different names after some time. Not sure if it has to do with unplugging and plugging back an HDMI cable to the monitor or switching out a graphics card, for example.
-
Is there a better way to pragmatically tell if a screen is on/off so you can toggle it? Currently I'm following this solution but is pretty ghetto.
Much appreciated.
Edited 17 Feb 2019. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 1 · 100% up
- Kind
- Text
- ID
- argwps
1 comment
Use autorandr. It switches xrandr profiles automatically when it detects that the conditions match. https://wiki.archlinux.org/index.php/Xrandr