-
Daniel Vrátil authored
KScreen can now handle laptop lid being closed or opened. Once we get the isLidClosedChanged signal, we wait for 2 seconds to find out whether it will trigger system suspend or not. This is atm the only way how to "detect" whether closing lid will suspend the computer or not. If the we don't get the aboutToSuspend() signal within 2 seconds (an arbitrary constant), we save the current config with "_lidOpened" suffix and turn off the output. When we are notified that lid has been opened, we first check whether a config file with the same ID, but "_lidOpened" suffix exist, and if it does we use it to reconstruct the config prior to closing the lid. If there is no such config, we just try to come up with something (applyConfig()). This is far from perfect (stupid suspend detection, changes made to configs while laptop lid is closed will be forgotten once lid is opened again), but it works reasonably well. Plasma still seems to struggle with these complex changes, but that's another problem.
4585ee12