Context menu actions were reordered into a random order

Hello, I created this sub-menu called “Unreal Engine” for Dolphin’s context menu a few months ago. I originally arranged the actions in the order 1, 2, 3, 4, but at some point the order was changed and became random. It is not rearranged randomly every time, but it no longer stays in the original order. How can I re-arrange them back into the correct order?

Here is the code I am using:

[Screenshot]

[Code]

[Desktop Entry]
Type=Service
MimeType=application/x-uproject;
X-KDE-Submenu=Unreal Engine
Actions=LaunchAsGame;GenerateProjectFiles;CleanCachesFolder_BIS;CleanCachesFolder_BISD;

#Launch the project file as a game
[Desktop Action LaunchAsGame]
Name=1. Launch as Game
Icon=unreal-engine
Exec=/bin/sh -c ‘“/home/tiger/bin/unrealengine” “%u” -game’

#This will generate project files for Visual Studio Code
[Desktop Action GenerateProjectFiles]
Name=2. Generate Project Files for VS Code
Icon=visual-studio-code
Exec=/bin/sh -c ‘“/home/sharedFolder/UE_5.6.1/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh” -projectfiles -project=“%u” -game -engine -progress && notify-send “Unreal Engine” “Project files generated successfully” -i unreal-engine’

#This will delete these folders: Binaries, Intermediate, Saved. Proceed with caution.
#Same as rm -r Binaries Intermediate Saved
[Desktop Action CleanCachesFolder_BIS]
Name=3. Delete Cache (Bin.,Inte.,Saved)
Icon=folder
Exec=/bin/sh -c ‘for f in Binaries Intermediate Saved; do rm -r $f; done’

#This will delete these folders: Binaries, Intermediate, Saved, DerivedDataCache. Proceed with caution.
#Same as rm -r Binaries Intermediate Saved DerivedDataCache
[Desktop Action CleanCachesFolder_BISD]
Name=4. Delete Cache (Bin.,Inte.,Saved.,Deri.)
Icon=folder
Exec=/bin/sh -c ‘for f in Binaries Intermediate Saved DerivedDataCache; do rm -r $f; done’

Dolphin: 25.12.0
Operating System: Arch Linux
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.18.2-arch2-1 (64-bit)
Graphics Platform: Wayland

Number the actions. For example: [Desktop Action 1GenerateProjectFiles]

1 Like

hi, welcome.

you were close but the sorting that takes place is not based on the Name= value, it is based on the Actions= value.

so prepend a number to the front of each Action= (same as then number in Name= ) and everything should sort… you may need to restart dolphin or the desktop to see the change.

1 Like

It’s working. Thank you.

1 Like

FYI, this was the behavior until KDE Frameworks 6.0 but this regressed during porting and corrected back to old correct behavior in 6.20 with kfileitemactions: use actionsKey instead of name to check KAuth (!2048) · Merge requests · Frameworks / KIO · GitLab

This allows to not have alphabetic ordering for your contextual actions.

1 Like