[HowTo] Create a Desktop Shortcut KDE Service Menu

This service menu is designed as a tool to effortlessly create one or more shortcuts from the file manager, using a symbolic link generated with a quick right mouse click. My user case is that I tend to send multiple work-in-progress files to my desktop simultaneously, and this satisfies my needs.

The ServiceMenu will be created in ~/.local/share/kio/servicemenus/

If that path doesn’t exist for your user, create it with:

mkdir -p ~/.local/share/kio/servicemenus

Create createdesktopshortcut.desktop with kate:

kate ~/.local/share/kio/servicemenus/createdesktopshortcut.desktop

Add the lines:

[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;
X-KDE-StartupNotify=false
X-KDE-Priority=TopLevel
Actions=sendDesktop;

[Desktop Action sendDesktop]
Name=Create desktop shortcut
Name[de]=Desktopverknüpfung erstellen
Name[fr]=Créer un raccourci sur le bureau
Name[es]=Crear acceso directo del escritorio
Name[hr_HR]=Asztali parancsikon létrehozása
Name[nl]=Snelkoppeling op het bureaublad maken
Name[da]=Opret skrivebordsgenvej
Name[pt]=Criar atalho na área de trabalho
Name[nb]=Lag skrivebords snarvei
Name[pt_BR]=Criar atalho na área de trabalho
Name[ru_RU]=Создать ярлык на рабочем столе
Name[sr]=Napravi prečicu na desktopu
Exec=/bin/ln -s %F ~/Desktop
Icon=desktop

Please notice that you may need to run chmod to make sure it will work with your user

chmod +x createdesktopshortcut.desktop

That’s all.

Why? A .desktop file (if properly made) contains metadata to inform the desktop environment how to associate programs to file types, and execute the defined Exec but was never designed to execute itself.

Check my last how-to about a service menu for vlc.

A forum member complained about not being able to run the service menu unless he made it executable.

:person_shrugging: