Improve the behaviour of the power button on mobile
ClosedPublic

Authored by apol on Feb 6 2020, 12:16 PM.

Details

Summary

On Mobile, if the power button is pressed for short time, suspend to Ram as
requested by Bhushan. If the power button is pressed for over a second show a
menu asking whether to reboot, shut down and others like we show on the
desktop.

Albeit pretty cool and useful, this can't be translated into the desktop
because there press time is always 0ms for some reason.

See https://phabricator.kde.org/D26899

Diff Detail

Repository
R122 Powerdevil
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Feb 6 2020, 12:16 PM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 6 2020, 12:16 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
apol requested review of this revision.Feb 6 2020, 12:16 PM
broulik accepted this revision.Feb 6 2020, 12:40 PM
broulik added a subscriber: broulik.
broulik added inline comments.
daemon/actions/bundled/handlebuttonevents.cpp
79

Use new connect syntax in new code please

daemon/powerdevilbackendinterface.h
70

Please document what PowerDownButton is, especially that it has this magic behavior in kglobalaccel

This revision is now accepted and ready to land.Feb 6 2020, 12:40 PM
z3ntu added a subscriber: z3ntu.Feb 6 2020, 1:22 PM

On Mobile, if the power button is pressed for short time, suspend to Ram as requested by Bhushan.

Regarding this behavior, it will not always be desirable to do that, especially if user interaction is still happening, e.g. listening to music, having an active USB connection (because it'll close) for copying files or doing something over ssh, etc.

z3ntu awarded a token.Feb 6 2020, 1:23 PM
apol added a comment.Feb 6 2020, 2:24 PM

Regarding this behavior, it will not always be desirable to do that, especially if user interaction is still happening, e.g. listening to music, having an active USB connection (because it'll close) for copying files or doing something over ssh, etc.

I mentioned something along the lines to @bshah, he said he'll figure it out.

bshah added a comment.Feb 6 2020, 2:25 PM

he said he'll figure it out.

(I have plan on how to handle that).

apol updated this revision to Diff 75106.Feb 6 2020, 2:50 PM

address documentation, connect

This revision was automatically updated to reflect the committed changes.