Bug 353029

Summary: Shuting down the system with notebook lid closed changes KScreen settings to not enabled
Product: [Plasma] KScreen Reporter: Heiko Tietze <tietze.heiko>
Component: libkscreenAssignee: Daniel Vrátil <dvratil>
Status: RESOLVED FIXED    
Severity: normal CC: sebas
Priority: NOR    
Version: 5.4.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on: 351826    
Bug Blocks:    

Description Heiko Tietze 2015-09-22 06:51:07 UTC
My notebook is placed right of the TFT display. Closing the lid switches it off and it comes on when I open the lid. But when I shutdown the system with lid closed this setting is stored and the option enabled gets unchecked.
Additionally, KScreen doesn't store the position which is quite annoying since it makes realignment neccessary too. Would be a different bug although.

Reproducible: Always

Steps to Reproduce:
1. Close lid
2. Restart
3. Lid open does not activates the screen
4. Enable display in KScreen

Actual Results:  
Screen off after reboot

Expected Results:  
Screen on/off depends only on lid position and settings are persistent after restart
Comment 1 Sebastian Kügler 2016-05-04 02:06:41 UTC
What happens here is the that configuration profile for open lid is moved out of the way once it's closed. It would move back if you open the lid while it's running, but if you shut the machine down with the lid closed, the config won't be found on next reboot (with the lid open). (That's what the code does, as far as I can see.)

Does this match your observed behavior?
Comment 2 Heiko Tietze 2016-05-04 06:48:41 UTC
Mostly it does. Me have to wait until the system is fully shut down until the lid can be closed safely.

Playing with the lid is very error-prone in respect to Plasma in general. I have control bars on bottom and top of the desktop at both screens. On the notebook there are also some plasmoids showing the system state (i.e. load, hard disc, network). It happens often that the control bars are placed on the first screen after lid close. The plasmoids never move. Sometimes screens are reversed, left/right.

So from what you say, moving config files around, which sounds weird, I'd confirm your diagnosis.
Comment 3 Sebastian Kügler 2016-05-04 11:37:56 UTC
Screen configuration and widgets moving around are two different things, I'll concentrate on getting the screen setup right here. Widget moving around needs to be fixed elsewhere (perhaps https://git.reviewboard.kde.org/r/125451/ will help there).

I'll have a look at this specific case, though, hopefully we can easily make the lid closing state work better.
Comment 4 Sebastian Kügler 2016-08-17 03:45:59 UTC
I was able to reproduce the problem. We need to check if the lid state has changed when the config was saved last, and restore a config that was saved when the lid was opened if it is. This also makes the positioning work, which isn't saved if only one display is enabled.

Proposed patch: https://phabricator.kde.org/D2465
Comment 5 Sebastian Kügler 2016-08-19 11:06:04 UTC
Aaaaaand fixed. Thanks for helping to identify the problem!
Comment 6 Heiko Tietze 2016-08-21 12:52:19 UTC
(In reply to Sebastian Kügler from comment #5)
> Aaaaaand fixed. Thanks for helping to identify the problem!

Best comment ever. Thanks for all your work!