Comment 7 for bug 1573345

Revision history for this message
K4LiN (kalinq) wrote :

Hi,

I think I had similar issue. Mine was more related to suspend on lid close, but maybe you'll find something useful. My second screen position was resetting and overlaying primary laptop screen after resuming from suspend.

I noticed that in my journalctl that during lid close kscreen.kded is sending

"Lid closed, waiting to see if the computer goes to sleep..."
(https://github.com/KDE/kscreen/blob/master/kded/daemon.cpp#L291)

After timeout, which is set here btw:

m_lidClosedTimer->setInterval(1000);
(https://github.com/KDE/kscreen/blob/master/kded/daemon.cpp#L110)

it triggered this code:

"Lid closed without system going to suspend -> turning off the screen"
(https://github.com/KDE/kscreen/blob/master/kded/daemon.cpp#L324)

which is causing turning off the screen and saving info about that in new config. Then, after resume from suspend, position of second monitor is set to (0,0) and is overlaying the primary one..

The thing is that it should not trigger that function on timeout, because my system is going to suspend and counting down should be stopped. The thing is that function which is responsible for stopping the timer is not triggering.
(https://github.com/KDE/kscreen/blob/master/kded/daemon.cpp#L125)

And that is because of other error during kscreen daemon start:
kscreen.kded: PowerDevil SuspendSession action not available!
kscreen.kded: "The name org.kde.Solid.PowerManagement was not provided by any .service files"
(https://github.com/KDE/kscreen/blob/master/kded/device.cpp#L77)

I am not very familiar with all that stuff, but it looks like kscreen daemon is starting too soon and there's no power devil yet, so kscreen deamon doesn't have a reference to powerdevil "aboutToSuspend" signal or something...

Anyway. When I reload kscreen in KDE settings or from command line - suspend on lid close is working as expected.

Adding this script to KDE autostart works for me as an workaround of the issue:

sleep 10 && qdbus org.kde.kded5 /kded org.kde.kded5.unloadModule kscreen && qdbus org.kde.kded5 /kded org.kde.kded5.loadModule kscreen

Best!