Bug 391782

Summary: powerdevil defaults to do nothing when closing laptop lid
Product: [Plasma] Powerdevil Reporter: jm.ouwerkerk
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: critical CC: girard.nicolas, kde, nate, phaoost
Priority: NOR    
Version: 5.12.4   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 5.12.5

Description jm.ouwerkerk 2018-03-12 21:33:10 UTC
Latest powerdevil appears to default to doing nothing when closing the laptop lid. In terms of usability this is a somewhat poor default. I do not know whether it is relevant, but I start plasma + kwin using `startplasmacompositor`, i.e. running a Wayland setup.

Steps to reproduce:

 1. Install your plasma system
 2. Login on a tty & run `startplasmacompositor`
 3. Close laptop lid.
 4. Notice nothing happens.
 5. Log off/kill your plasma session
 6. Close laptop lid.
 7. Notice logind takes care of business as expected.
 8. Run another Plasma session (`startplasmacompositor` again) 
 9. Take a closer look at power settings in system settings
 10. Notice "Button events handling" is not checked, notice the greyed out option for configuring laptop lid handling is marked as "do nothing"
 11. Manually configure closing the laptop lid to suspend to RAM.
 12. Apply settings.
 13. Observe things work as expected, again, from within Plasma.

Extra information:

 - I am using systemd/logind
 - kscreen-console says:

==================================================================

Screen:
        maxSize: QSize(64000, 64000)
        minSize: QSize(0, 0)
        currentSize: QSize(1600, 900)

-----------------------------------------------------

Id:  1
Name:  "eDP-1-unknown"
Type:  "Panel (Laptop)"
Connected:  true
Enabled:  true
Primary:  true
Rotation:  1
Pos:  QPoint(0,0)
MMSize:  QSize(290, 170)
Size:  QSize(-1, -1)
Scale:  2
Clones:  None
Mode:  "0"
Preferred Mode:  "0"
Preferred modes:  ("0")
Modes: 
         "0"    "3200x1800@60"   QSize(3200, 1800)   60000
         "1"    "3200x1800@48"   QSize(3200, 1800)   48011
EDID Info: 
        Unavailable
Comment 1 Nicolas Girard 2018-04-25 08:42:37 UTC
Confirmed here on Kubuntu 18.04beta.
powerdevil 5.12.4.

The importance of this issue should be raised, since users might damage their laptops by carrying them without realizing they're not suspended, as reported here: https://bugs.kde.org/show_bug.cgi?id=349750
Comment 2 Kai Uwe Broulik 2018-04-25 08:51:34 UTC
It broke with the shortcuts migration, the config file will never be empty and as such it will never generate its default profiles, omg. will fix asap.
Comment 3 Kai Uwe Broulik 2018-04-25 08:58:21 UTC
Git commit be91abe7fc8cc731b57bec4cf2c004c07b0fd79b by Kai Uwe Broulik.
Committed on 25/04/2018 at 08:57.
Pushed by broulik into branch 'Plasma/5.12'.

Ignore "migration" key for determining whether the config is empty

Otherwise we would never generate the default power management configuration
leading to it not suspending on lid close, not handling power buttons etc etc

CHANGELOG: Fixed bug that caused power management system to not work on a fresh install

Reviewed-By: David Edmundson
FIXED-IN: 5.12.5

M  +7    -1    daemon/powerdevilcore.cpp

https://commits.kde.org/powerdevil/be91abe7fc8cc731b57bec4cf2c004c07b0fd79b
Comment 4 Nicolas Girard 2018-04-25 09:18:50 UTC
Wow, that was zipping fast, thanks a lot !
Comment 5 Nicolas Girard 2018-04-25 10:03:57 UTC
*** Bug 382114 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2018-04-25 12:43:22 UTC
*** Bug 382114 has been marked as a duplicate of this bug. ***