Bug 495390

Summary: shutdownType key in ksmserverrc can override the intended behavior of the "Show Logout Screen" option action
Product: [Plasma] plasmashell Reporter: Eric Valette <eric.valette>
Component: Desktop ContainmentAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: filip.kendes1, nate, notmart, rpbikker
Priority: NOR    
Version: 6.2.2   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.3
Sentry Crash Report:
Attachments: showcase

Description Eric Valette 2024-10-26 16:04:11 UTC
SUMMARY

Before migrating to kde/plamsa 6, when adding the  "Show Logout Screen" in the mouse option for background, I was propsed with all option : that suspend, reboot, shutdownn ...

Starting with 6.1, I'm only proposed the shutdown/cancel menu. On my laptop I mostly use suspend or reboot.


STEPS TO REPRODUCE
1.  Add the  "Show Logout Screen" item in the right click option on the Desktop parameter option-> mouse options-> righ click menu
2. Click right on desktop background
3. Only shutdown/cancel option is proposed

OBSERVED RESULT
Only shutdown/cancel option is proposed

EXPECTED RESULT

I was used to have all shutdown option like on sddm screen (suspend/reboot, shutdown, lock; ...)

SOFTWARE/OS VERSIONS

Linux/KDE Plasma:  Linux 6.6.58
KDE Plasma Version: 6.6.2
KDE Frameworks Version: 6.6.2
Qt Version: 6.7.2

ADDITIONAL INFORMATION
See bug 488832 to see other people requesting same thing for the plasmoid component.
Comment 1 Filip 2024-10-26 18:33:41 UTC
This should be implemented in Plasma 6.2.0 and it is working correctly on my PC. I also uploaded a video as attachment.

What software version do you have? Plasma 6.6.2 and KDE Frameworks 6.6.2 don't exist yet, latest version are Plasma 6.2.2 and KDE Frameworks Version: 6.7.0.

If you're not on 6.20. you'll need to update to get this feature.

My system:
Operating System: Arch Linux 
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.8.0
Kernel Version: 6.11.5-arch1-1 (64-bit)
Comment 2 Filip 2024-10-26 18:33:55 UTC
Created attachment 175258 [details]
showcase
Comment 3 Eric Valette 2024-10-26 21:14:32 UTC
(In reply to Filip from comment #1)
> This should be implemented in Plasma 6.2.0 and it is working correctly on my
> PC. I also uploaded a video as attachment.

I have a single PC that behaves as yours and two that behaves differently.  If you really want a video I can do it but please trust me. The logout screen is the same as if I use "shutdown" item at the bottom of kde bottom left menu (kde launcher if I translate from french).

> What software version do you have? Plasma 6.6.2 and KDE Frameworks 6.6.2
> don't exist yet, latest version are Plasma 6.2.2 and KDE Frameworks Version:
> 6.7.0.
> 
> If you're not on 6.20. you'll need to update to get this feature.

6.20? Typos?

dpkg -l *framework*6

Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom                   Version      Architecture Description


+++-=====================-============-============-=================================================
ii  frameworkintegration6 6.6.0-1      amd64        integration of Qt application with KDE workspaces

I do not know what package and version I should report for "KDE Frameworks". Tell me.

dpkg -l plasma-desktop
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom            Version      Architecture Description
+++-==============-============-============-=================================
ii  plasma-desktop 4:6.2.2-1    amd64        Tools and widgets for the desktop

This is QT/KDE from debian/unstable + KDE/QT from experimental. NB: all computers I have recently upgraded do have nearly the same packages set (maybe a day or two  delta) and versions for plasma and kde6 (maybe one day difference but the behavior has been different since I upgraded to KDE6. One kept working as before and the others now only propose shutdown/cancel but this has been so for since end of August.

I use breeze black theme.
Comment 4 Filip 2024-10-27 07:29:14 UTC
yeah, it was a typo, wanted to say 6.2.0, sorry.

If you go to the System Settings -> About this System page you will see Plasma, KDE frameworks, Qt and kernel versions, and graphics platform. That info should always be included + additional info as needed.

It looks like you're up to date, so I'll move the ticket back to reported status.
Comment 5 Eric Valette 2024-10-27 08:54:24 UTC
I confirm 
KDE plasma 6.6.2
KDE framework 6.6.0
QT 6.7.2

I upgraded yesterday a system that only shows shutdown/cancel as logout page to be sure to be in sync with the working one and no change. On this system doing Ctlr/Alt/Del brings me the expected logout  page but that is not what I want to do.

Thanks for your time. No clue why they behave differently, with most devices exhibiting the annoying version of shutdown page.
Comment 6 Nate Graham 2024-10-28 01:56:22 UTC
If you remove that item from your context menu, then apply/save, then re-add it, does it start working properly?
Comment 7 Eric Valette 2024-10-28 08:49:51 UTC
No it does not.  I did remove the shutdown item, applied chnages, closed. I was indeed removed when i clicked on background. Added it back, selected but no change.

However, I noticed that at least on one machine (will test on a second one) when I enter the mouse part of the desktop/background configuration for modifying the mouse buton events, I always have a message saying configuration has changed and I need to apply it. I apply it, and leave menu but without doing anything else, if I reenter the same menu it says it again as if the config file for the menu was not correctly modified.
Comment 8 Eric Valette 2024-10-28 09:25:33 UTC
Upgraded my laptop also. Here removing and re-adding the shutdown item in the menu also fails to correct the shutdown menu behavior.  

In addition, my laptop does not ask for applying modified config when entering the mouse menu. So maybe the other PC behavior is unrelated.

Sorry for the bad news and thanks for your help.
Comment 9 Eric Valette 2024-10-28 09:32:51 UTC
I also tried to completely delete the right button action (added left, removed right, then re-added right and shutdown menu item). Still no change.
Comment 10 Nate Graham 2024-10-28 14:45:04 UTC
Can you attach a screen recording that shows the issue happening, so I can be sure I'm testing in the same way?
Comment 11 Eric Valette 2024-10-28 15:32:44 UTC
Look at the attachment already done by Filip. I test it the exact same way. On one machine it behaves correctly: I have the expected  complete shutdown menu with all option (same as Filip). On the two others, I have the same logout screen that you get if you do it from the bottom of the kde launcher with the shutdown icon, that is only shutdown/cancel displayed. I need suspend to ram and reboot at least.

To enable the shutdown menu on background mouse click,  click with mouse on background with either left or right (depend on your own config) then Desktop and background menu -> mouse event menu> then the config item for a mouse button will show a list of possible item you get when clicking. Select show logout screen (wording may differ a bit I translate from french).

As said I tested with removing the option/readding it, or event totally removing the right click menu and adding a pristine one again. No way to make it work. Behavior stays identical on faulty machine. If I knew what config file it modifies (to store the expected menu layout), I could look at the possible file difference.

The bad news is that it may work on your computer as it does on one of mine. So it is not a systematic bug, it probably depend on config files that may comes from ages... But the rest of the system works perfectly and I'm a bit picky about my work environment...

The config enabling logout on background  right click was working with kde5, then it stopped working when I upgraded to kde6. NB : the upgrade started with kde/plasma 6.1 not 6.2...
Comment 12 Reinier 2024-10-28 21:25:56 UTC
I had nearly the same issue, in my case with a laptop that only shows the reboot option and a desktop that shows all options. 

The culprit is a single line in the file ~/.config/ksmserverrc. Open it in an editor, look for the [General] section and remove or comment out the line with "shutdownType=<number>". In your case that number will be 2, in my my case it was 1.

I'm not sure, but I think this line is a remnant of a pre-5.27 feature, where you could configure the default Leave option. That feature is no more and I think it's a bug that the presence of this line restricts the log out options to only one.
Comment 13 Eric Valette 2024-10-29 08:19:59 UTC
(In reply to Reinier from comment #12)
> I had nearly the same issue, in my case with a laptop that only shows the
> reboot option and a desktop that shows all options. 
> 
> The culprit is a single line in the file ~/.config/ksmserverrc. Open it in
> an editor, look for the [General] section and remove or comment out the line
> with "shutdownType=<number>". In your case that number will be 2, in my my
> case it was 1.

Bingo. Yes the shutdownType=2 was there and commenting it fixed the problem.

> I'm not sure, but I think this line is a remnant of a pre-5.27 feature,
> where you could configure the default Leave option. That feature is no more
> and I think it's a bug that the presence of this line restricts the log out
> options to only one.

Sure it is because if you are a bit conscious about electronic waste, you keep your computer as long as you can (more than seven years for laptop and even more than 10 years for high end desktop)  and when forced to change the hardware (failure in my case), you keep your personal data and the .config is there... So the probability to get this kind of leftover in config is high.
Comment 14 Nate Graham 2024-10-29 14:26:05 UTC
Brilliant detective work, folks. I'll get that fixed.
Comment 15 Bug Janitor Service 2024-10-30 01:05:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4880
Comment 16 Nate Graham 2024-10-30 14:46:17 UTC
Git commit aea4683c03f837ad2fd0960d814514e9b51b7b60 by Nate Graham.
Committed on 30/10/2024 at 14:46.
Pushed by ngraham into branch 'master'.

Always show full logout screen for "Show Logout Screen" desktop menu item

Showing the full logout screen is the intention, and it's what the
user-facing text suggests will happen.

However right now it is not always the case, because the code queries the
value of `shutdownType` in the ksmserverrc config file. This is a legacy
config key that there's no UI to set anymore, so we shouldn't be honoring
it anywhere.
FIXED-IN: 6.2.3

M  +1    -17   containmentactions/contextmenu/menu.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/aea4683c03f837ad2fd0960d814514e9b51b7b60
Comment 17 Nate Graham 2024-10-30 15:08:26 UTC
Git commit 7838c34434b5046bd54f7e4988e56ed6896965a6 by Nate Graham.
Committed on 30/10/2024 at 14:49.
Pushed by ngraham into branch 'Plasma/6.2'.

Always show full logout screen for "Show Logout Screen" desktop menu item

Showing the full logout screen is the intention, and it's what the
user-facing text suggests will happen.

However right now it is not always the case, because the code queries the
value of `shutdownType` in the ksmserverrc config file. This is a legacy
config key that there's no UI to set anymore, so we shouldn't be honoring
it anywhere.
FIXED-IN: 6.2.3


(cherry picked from commit aea4683c03f837ad2fd0960d814514e9b51b7b60)

2ed51c4f Always show full logout screen for "Show Logout Screen" desktop menu item

Co-authored-by: Nate Graham <nate@kde.org>

M  +1    -17   containmentactions/contextmenu/menu.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/7838c34434b5046bd54f7e4988e56ed6896965a6
Comment 18 Eric Valette 2024-10-31 08:48:44 UTC
(In reply to Nate Graham from comment #17)
> Git commit 7838c34434b5046bd54f7e4988e56ed6896965a6 by Nate Graham.
> Committed on 30/10/2024 at 14:49.
> Pushed by ngraham into branch 'Plasma/6.2'.


Thanks a lot for the fix. 

BTW looking at the ksmserverrc file, it also contains garbage in [Session: saved at previous logout] with path for non existing programs so 
    1) It is clearly not always updated on logout (e.g I have a reference to /usr/local/bin/ktorrent that I have removed from as soon as official 24.08 package was available in Debian experimental (several weeks))
    2) Even if "start with empty session" is set it seems to still keep recording program windows position?

So maybe having a fresh look at what kmserver does with this config file may be worth. I can open a bug if needed.

Thanks again.
Comment 19 Nate Graham 2024-10-31 16:21:01 UTC
Yes, please open new bug reports for those other issues. Thanks!