Summary: | Power button actions should be handled from lock screen | ||
---|---|---|---|
Product: | [Plasma] Powerdevil | Reporter: | Kishore Gopalakrishnan <kishore96> |
Component: | general | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | CONFIRMED --- | ||
Severity: | wishlist | CC: | ad.liu.jin, amcnabb, anatol.rosch, bernie, bhush94, bleyddyn.aprhys, bugs.kde, christ.derek, dfasre, dvs-1111, girard.nicolas, grahamperrin, henvin.3, hohmuth, jens-bugs.kde.org, Jens.Rutschmann, kde, kde, kde, kdudka, kortrax11, luca-kde, matthias.sweertvaegher, mgraesslin, miguel, natalie_clarius, nate, neko.eth0, oss+kde+bugzilla, peter, pmartycz, polarathene-signup, postix, ppaalanen, priomsrb, public, qinq_net, ra, rewarp, stefan.bruens, voidpointertonull+bugskdeorg |
Priority: | NOR | ||
Version: | 5.16.0 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=336369 | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | add suspend action to KDE Plasma lock screen |
Description
Kishore Gopalakrishnan
2018-04-06 12:51:57 UTC
@Martin I thought this was intentional? We don't show a shutdown UI either. We don't show a UI, but the actions on power button and lid close should still work, shouldn't they? After all I doubt that powerdevil knows that the screen is locked and kscreenlocker knows nothing about physical buttons. I need to whitelist the global shortcuts for power off in kscreenlocker then. However, how is allowing to press a keyboard combination to shutdown any different from clicking a UI button that we deliberately not out there to avoid "unauthorized interruption of a potentially running task" such as in a lab you always brought up? Is the power button just a global shortcut? I thought that this is a physical event. Now thinking about it I doubt it makes sense to allow it as we cannot show ksmserver's logout dialog. shutdown is a problem as we potentially have app prompts for example if there's unsaved changes. This doesn't apply for suspend/hibernate. Confirmed here on Kubuntu 18.04beta. kscreenlocker 5.12.4 as well. To be fair, I often just change TTY and press the suspend button there. It should also work with the power button to poweroff the computer (or ctrl-alt-del), so some points here are rather moot. Showing a confirmation UI (maybe with a timer) would probably be a better solution. Ideally, the screen locker could know what kind of activity there is in the background (KTorrent downloading, disk copy, compilation) and show a message that some actions could be interrupted, but that might be just me overthinking this. Can System Settings for the lockscreen not have a UI toggle for soft buttons to allow shutdown/suspend/hibernate? Sometimes I've suspended the machine only to find it wake up again shortly after, I have to manually type out the password again just to attempt a suspend once more. It'd be nice if the user has allowed the lockscreen to display power button UI, that you could then do such actions via lockscreen without requiring an unlock. My machine isn't a laptop and it's power button isn't that accessible. Suspend shouldn't cause any harm/risk to running processes and the like? If such a setting were off by default it shouldn't cause any harm/risk to other users that is mentioned for avoiding it? This is possibly related to bug 336369 which requests a GUI item to trigger suspend while this bug requests functionality for normal power/suspend keys. In that enhancement request, Kai said: > We removed the shutdown option and the like due to security reasons, so it doesn't make sense to add a suspend option, I suppose? There were also some arguments from Nate about how other platforms (Windows, macOS, GNOME) still provide the options to shutdown/suspend the device. Given that in most cases (*handwaving*) Plasma runs on consumer laptops and desktops, and not in a lab setting, what about handling suspend/power buttons (and add GUI buttons if necessary) by default and provide a setting to disable it if necessary (for lab setups?)? In many setups, you could also pull out the battery, remove the power cable or force-press the power button. To illustrate why I find this feature desirable: sometimes I lock a screen, walk away and when I return, I just want to suspend it using a shortcut from the lock screen. That does not work at the moment, I have to type a long password just to be able to suspend (inconvenient if I am in a hurry). Yes, please (pretty please) add an option to shutdown, logout, suspend etc. from the lock screen. It's fine to have an option to hide those buttons but this should not be the default. Any security considerations are invalid if the machine is physically accessible (since a user could just pull the plug to "shut down", or press the power button a little longer). And I just switched from Unity on Ubuntu 16.04 to KDE (Neon) and I am sorely missing this feature too. Thanks! I just noticed that I can't suspend my desktop from the lockscreen in Plasma 5.16, and I was surprised it wouldn't work the same way of closing the lid on a laptop. Both Windows 10 and OSX can sleep / restart / shutdown from the lockscreen, while Gnome only supports sleep and restart (but the latter mysteriously shows a padlock when you click on it). So, supporting sleep seems uncontroversial, while restart and shutdown might be what most users expect to find, but if there's no consensus we could move the discussion to a separate bug. please make the power button work on the lock screen. my situation: I configured the power button to suspend the system. This works when logged in, but not on the lock screen. Funnily enough, when I close the lid, it does suspend! However, due to repetitive opening/closing of the lid, the hinges are now damaged so it is no longer an option to open/close the lid. This is a stationary laptop so we just leave it open. Although this laptop is aging, it runs linux just fine. When do we need this behavior? During the evening, we leave the laptop on because you don't know whether you will use it shortly again or not. But when you're ready to go to sleep, the screen is already locked, and just pressing the power button is the only energy left to put the system to sleep ;) In any case, it's the most sensible action to take. Logging in, confronts you with new emails, new messages, etc, new stimuli you don't want when you want to finish the day. I don't know if there is a technical difference, but if the powerbutton is difficult to "grab" on the lockscreen, maybe support the dedicated suspend key? thanks matthias I would very like to see such a feature, too. It's very odd and inconvenient, that there is no way to suspend (or turn off the display) in the lockscreen. Also, the display timeout is in the lockscreen the same as normal, so it would take minutes until the dislay is turned off. To my situation: I take notes in the lectures with my notebook every day, and if the notebook accidently wakes up from suspend, I have no other way to turn the display back off than entering my password and after that press the power button. In windows I can press the power button right away and the problem is solved. Created attachment 127083 [details]
add suspend action to KDE Plasma lock screen
In my opinion, the reasonable thing to do would be giving the users a simple option to re-enable power actions on lock screen, and let the user decide whether the alleged security implications affect them (and for the very common scenario of a single session per machine, they don't). Sadly, according to #336369, "adding options is not the correct approach, this is not KDE 3". After 5 more years, we still got nothing. A hack for LockScreenUi.qml that re-enables power key handling is available at https://unix.stackexchange.com/questions/441989/suspend-linux-from-kde-plasma-5-lockscreen/576694 , i've attached a patch for convenience. Confirmed on kded5 5.67.0 and plasmashell 5.17.5 (Gentoo). This is bugging me too often. Is very hard for me to see a reason why you wouldn't want to allow suspending, and in any case I think leaving the option to the user to allow reboot and power-off too (even if is burried in some "Advanced" setting somewhere) would make a lot of sense. (In reply to Anatol Rosch from comment #14) > Created attachment 127083 [details] > add suspend action to KDE Plasma lock screen Thanks for sharing! The above patch has solved the problem for me. The "Sleep" button in the UI is not aligned with the "Switch User" button but the HW button now finally makes the machine suspend even when the screen is locked. I was looking for a way to have my desktop shut down on power button press, even if the screen is locked. I suppose this bug is it. I'd like to point out that if someone is able to press the physical power button, they are also able to press it long enough that the machine cuts power without a normal shutdown. If they can access the power button, they could probably just pull the power cable, too. Therefore I think the security aspect of the justification to not allow shutdown while locked is very much undermined. Surely it's better to force programs to quit during normal shutdown than it is to kill power. (In reply to ppaalanen from comment #18) > > I'd like to point out that if someone is able to press the physical power > button, they are also able to press it long enough that the machine cuts > power without a normal shutdown. If they can access the power button, they > could probably just pull the power cable, too. Therefore I think the > security aspect of the justification to not allow shutdown while locked is > very much undermined. Surely it's better to force programs to quit during > normal shutdown than it is to kill power. I completely agree. The recent severity /priority downgrade (severity: normal -> wishlist ; priority: high -> normal) doesn't make sense to me **at all**. (In reply to Kamil Dudka from comment #17) > (In reply to Anatol Rosch from comment #14) > > Created attachment 127083 [details] > > add suspend action to KDE Plasma lock screen > > Thanks for sharing! The above patch has solved the problem for me. The > "Sleep" button in the UI is not aligned with the "Switch User" button but > the HW button now finally makes the machine suspend even when the screen is > locked. To have the buttons be aligned, add this to the new ActionButton block. The anchors section should look just liek the the one for the existing "Switch User" ActionButton. anchors{ verticalCenter: parent.top } After upgrade to plasma 5.24.4 I can see "Sleep", "Hibernate", and "Switch User" buttons on my lock screen. The first two hunks of attachment #127083 [details] are still needed to keep the HW power button functional while the screen is locked.
(In reply to Kamil Dudka from comment #21) > After upgrade to plasma 5.24.4 I can see "Sleep", "Hibernate", and "Switch > User" buttons on my lock screen. The first two hunks of attachment #127083 [details] > [details] are still needed to keep the HW power button functional while the > screen is locked. I never paid attention to the GUI update recently but it's still pretty bad that I need to turn on monitor, to sleep my computer. I've actually been logging in completely then hitting the power button. Always making sure nobody sees how silly my actions my appear. (kubuntu 22.04, plasma 5.24.7, KDE Frameworks 5.92.0, QT 5.15.3, X11) There is a little hack: even when screen is locked, keyboard shortcuts are still available. So you can go to settings -> shortcuts -> power -> suspend (or hibernate) -> assign a new shortcut -> push power button (agree reassign) Now suspend (or hibernate) works in every case (logged in or lockscreen) (In reply to Dm from comment #23) > (kubuntu 22.04, plasma 5.24.7, KDE Frameworks 5.92.0, QT 5.15.3, X11) > There is a little hack: even when screen is locked, keyboard shortcuts are > still available. So you can go to settings -> shortcuts -> power -> suspend > (or hibernate) -> assign a new shortcut -> push power button (agree reassign) > Now suspend (or hibernate) works in every case (logged in or lockscreen) This seemed to work for me. I no longer have to switch the kvm and/or turn on monitor to log in to hit the power button. I highly recommend manually removing the original shortcut since it suspended my computer mid-process. I would like to chime in with a particular setup that makes the lack of an easy access to the shutdown procedure from the power button from the lock screen dangerously insecure. I am setting up servers for schools running openSUSE with docker containers containing various services, with the Plasma interface. They are designed to be as easy to use as possible since we are talking about primary and secondary schools. No one expects any teacher there to be a moonlighting sysadmin. To shutdown the server properly in such a scenario would be too much of a hassle for them, so I used the system settings for power management to trigger a shutdown when the power button is pressed. However, the power button doesn't work if the screenlock is on. The screenlock should ideally be on so that teachers and trusted students can access the desktop interface for whatever reason. The only protection therefore for such a unit thus far in an exposed environment is the lack of a KVM. I can imagine that's not going to be much of a barrier for kids determined to do mischief. So my hope is there will be a user toggle option that allows the power button to shutdown the system safely should it be necessary from the lockscreen. (In reply to Dm from comment #23) > (kubuntu 22.04, plasma 5.24.7, KDE Frameworks 5.92.0, QT 5.15.3, X11) > There is a little hack: even when screen is locked, keyboard shortcuts are > still available. So you can go to settings -> shortcuts -> power -> suspend > (or hibernate) -> assign a new shortcut -> push power button (agree reassign) > Now suspend (or hibernate) works in every case (logged in or lockscreen) Another workaround is to use the "tiny-power-button" Linux kernel module. This module waits for power button presses (like the "button" module that most desktop environments use), but instead of sending the event to user-space it directly sends a shutdown signal to your init manager. This completely bypasses KDE-Plasma and thus allows the power button to work while the screen is locked. Note: 1. Your kernel must have been compiled with the tiny-power-button module 2. Your init manager must support shutdown signals 3. This module only waits for power button presses 4. If compiled as a module, tiny-power-button must be loaded on every boot 5. The button module must not be loaded before or after the tiny-power-button module is loaded 6. If the button module was compiled directly into the kernel you may need to do other modifications The relevant Kconfig option for note 1 is CONFIG_ACPI_TINY_POWER_BUTTON=m or CONFIG_ACPI_TINY_POWER_BUTTON=y. By default, the signal used in note 2 is different than SIGTERM and friends, and causes a graceful shutdown. Most init managers (like SystemD) support it, but you could theoretically use another signal at the risk of data loss. Due to note 3, events like closing the lid wouldn't work and thus this workaround may not be suitable for laptops. Note 4 can be achieved on most systems by adding "tiny-power-button" to /etc/modules. Note 5 can be achieved on most systems by adding "blacklist button" to /etc/modprobe.d/blacklist.conf. The problematic Kconfig option in note 6 would be CONFIG_ACPI_BUTTON=y, however you might still be able to use this workaround by adding additional boot arguments. The workaround from comment #23 didn't work for me. I went to Energy Saving and turned off suspending when the power button is pressed (to avoid suspending while trying to create the shortcut), and then I tried to create the shortcut. Unfortunately, when I tried to enter the shortcut key by pressing the power button, nothing happened at all; it just didn't register as a key press. |