Bug 478582

Summary: Plasma 6 Folder Applet - Ability to set Contextual Menu Plugins through API scripting
Product: [Plasma] plasmashell Reporter: Frank <frankebay99>
Component: Desktop icons & Folder View widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: fanzhuyifan, hein
Priority: NOR Keywords: qt6
Version First Reported In: 5.90.0   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Contextual Menu Plugins

Description Frank 2023-12-15 20:47:25 UTC
Created attachment 164212 [details]
Contextual Menu Plugins

SUMMARY
***
We use Plasma API Scripting for our distro’s Global Theme and setting specific Contextual Menu Plugins allows more flexibility for the UX and better overall experience of the Theme.

Mainly the plugin LEAVE, accessible when right-clicking the mouse anywhere on the desktop wallpaper to call the context menu (mouse actions/right-button).

Currently Plasma allows to access the "Leave" actions through the Application Launcher. This requires to drag the mouse to the App Launcher and click on the desired action. It's a 3-click operation, 4 if you want to Lock, Logout or Switch User.

I am proposing a faster alternative (without removing the default one) that doesn't take user space and that is a 3-click-no-mouse-draggin operation for all actions. This is possible by including the "Leave" action when right-clicking on the desktop. I believe this makes the user's workflow faster and smoother. Same goes with the action "Lock Screen", which would then be accessible faster.

I think it would be interesting to have Plasma default to these, but if it doesn't, at least to have the ability to set those actions through API would help increase the UX for the Global Themes in which it fits well to have these features included.

I have read many documentations like https://develop.kde.org/docs/plasma/scripting/api/#applets-containments-and-widgets but no matter what I try to code in layout.js it does not apply that setting.

I cannot seem to write in the group [ActionPlugins][0][RightButton;NoModifier].


STEPS TO REPRODUCE
1. Use code in script following documentation above
2. Apply the Theme

OBSERVED RESULT
In ~/.config/plasma-org.kde.plasma.desktop-appletsrc the config is written in a different group/subgroup than required. The closest I could get is:

===
[Containments][2][ActionPlugins]
_logout=true
===


EXPECTED RESULT
It should look like this, in the below groups, in ~/.config/plasma-org.kde.plasma.desktop-appletsrc:

===
[ActionPlugins][0][RightButton;NoModifier]
_add panel=true
_context=true
_display_settings=true
_lock_screen=false
_logout=true
_open_terminal=false
_run_command=false
_sep1=true
_sep2=true
_sep3=true
_wallpaper=true
add widgets=true
configure=true
configure shortcuts=false
edit mode=true
manage activities=true
remove=true
===



SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch
KDE Plasma Version: 5.90.90
KDE Frameworks Version: 5.247
Qt Version: 6.6.1