Hi everyone! I recently created a custom service menu for the Dolphin file manager, but unfortunately, it doesn't seem to be working as expected.
My goal is to have a menu to convert image file formats quickly with image magick.
Here is the .desktop file I managed to arrange
[Desktop Entry]
Type=Service
Name=Convert Image
Icon=gtk-convert
MimeType=image/png;image/jpg;image/jpeg;image/ico;image/heic;image/svg;image/webp;
Actions=topng;tojpg;toico;towebp
X-KDE-Submenu=Convert Image
[Desktop Action topng]
Name=To Png
Exec=sh -c 'FILE="%f"; DIRECTORY="$(dirname $FILE)"; FILENAME="${FILE%.*}"; magick "$FILE" -format png "$DIRECTORY/$FILENAME.png"'
[Desktop Action tojpg]
Name=To Jpg
Exec=sh -c 'FILE="%f"; DIRECTORY="$(dirname $FILE)"; FILENAME="${FILE%.*}"; magick "$FILE" -format jpg "$DIRECTORY/$FILENAME.jpg"'
[Desktop Action toico]
Name=To Ico
Exec=sh -c 'FILE="%f"; DIRECTORY="$(dirname $FILE)"; FILENAME="${FILE%.*}"; magick "$FILE" -format ico "$DIRECTORY/$FILENAME.ico"'
[Desktop Action towebp]
Name=To Webp
Exec=sh -c 'FILE="%f"; DIRECTORY="$(dirname $FILE)"; FILENAME="${FILE%.*}"; magick "$FILE" -format webp "$DIRECTORY/$FILENAME.webp"'
When I right-click on an image my custom menu item appears as expected. However, when I click on the menu item, nothing happens. There are no error messages or any indication of what might be going wrong.
I made sure the .desktop file is executable and the sh script works when using it on the command line, so I'm out of ideas for what could be going wrong.
Are there any logs I can check to get more information about what's failing? I'm using plasma 6.3.3 on Arch btw
Edit: To answer how to troubleshoot custom service menus (specifically .desktops) the desktop-file-validate
cli utlility checks all the syntax errors and can provide solutions to what's wrong. For my use case though, using a script file for the Exec line and avoiding any double quotes was the practical way of assuring my service menu works.