Bug 480280 - Power management actions shown even when they don't fit the use case of remote login
Summary: Power management actions shown even when they don't fit the use case of remot...
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Session Management (other bugs)
Version First Reported In: 5.27.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2024-01-24 17:04 UTC by Sebastian Mogl
Modified: 2024-08-28 11:11 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Mogl 2024-01-24 17:04:53 UTC
Currently, all the Menus that allow one to leave KDE (logout, lock screen, poweroff, …) always assume a local session, even when running as a remote session under x2go, xrdp, etc.

However, when running remote the actions available don't fit the use case and should be in most cases limited to logging out and suspending the session. (Most are useless when regular users don't even have the permissions for things like power controls)

The lock screen could be argued over, I'm in favor of suspending the session and completely closing the connection in order to lock it.

The Mate Desktop solved this problem by using librda to detect how the desktop was started, which actions are available and calling the appropriate handlers.

librda: https://github.com/ArcticaProject/librda
Corresponding blog post: https://sunweavers.net/blog/node/82

Context: Librda detects remote sessions based on Environment variables and the logout/suspend functions call the appropriate commands.

This is a resubmitted version of Bug 479403 addressing its root cause.
Comment 1 Sebastian Mogl 2024-08-28 11:11:14 UTC
So after doing some research, this is probably best implemented as a session-management-backend in plasma-worspace in libkworkspace/sessionmanagementbackend.cpp¹.

* New Class that implements and only allows logout.
    * logout by running the command: `x2goterminate-session`
    * Session status would be always Ready
* Hook in initializer that uses the X2go-Backend if the `X2GO_SESSION` envoirnment variable is set before checking for logind after checking for the test session variable.

¹: https://invent.kde.org/plasma/plasma-workspace/-/blob/master/libkworkspace/sessionmanagementbackend.cpp

Locking could be handled by running `x2gosuspendsession`, but that isn't handled by the backends yet.