Closed romangg closed 8 months ago
For the laptop lid action we need to also listen for suspension of the device. We can do this with logind, i.e. by listening to the PrepareForSleep signal of the org.freedesktop.login1 service on the system bus.
In KDisplay the flow is like this:
<config-hash>-open-lid.json
file.<config-hash>-open-lid.json
file replaces the <config-hash>.json
one.There are two special cases (which also might not have been properly handled in KDisplay):
mentioned in commit 51b556597777c1315cc687017bd08a16a1c3f55a
Motivation
The display configuration of a laptop connected to an external display could be changed automatically depending on if the laptop lid is closed and if the laptop is in a docking station.
This was supported previously with the design to have all control file handling in KDisplay albeit it never worked without any issues.
Discussion
Laptop lid
It makes sense to have this in Disman. The internal display can be disabled when the lid is closed and enabled again when the lid is opened. We might want to only enable it again if the user has not manually changed the config in the meantime.
One question is what other service Disman should use to query the state of the lid. KDisplay used for that UPower what is probably also a good choice for Disman.
Docking station
When being docked but the lid open the configuration might only be changed in a way such that the panel is moved from the laptop display to the external display. This clashes though with other configurations depending on which output is connected. Also on Wayland this is not in the same way possible as on X11 since no primary output concept exists per se.
Besides, it is not clear how the KDisplay daemon queried the state of being docked or not. The code seems to do nothing.
Decision
For now it makes sense to only work on support for adapting the configuration on laptop lid open/close.