Help repackaging ReImage 2.5 for modern KDE

I recently wanted to find a good set of service menus for basic batch image manipulation in Dolphin. Reimage (https://www.egregorion.net/, KDE 5 Service Menu ReImage - KDE Store) seemed to be the best option, but when I tried installing it, it just failed silently. Even manually downloading the files and moving them into place manually failed silently.

On investigating it with desktop-file-validate, it turns out the .desktop files were full of errors on modern KDE. I couldn’t find any good documentation for the .desktop file format (Creating Dolphin Service Menus | Developer was very surface level and Desktop Entry Specification was missing a lot of stuff) so ended up tweaking the .desktop files until they did work.

Now I’m trying to package it up again in a format where people can actually install and use it successfully, and I have some questions:

Practical questions for re-releasing ReImage

  1. Is there a different, modern, better-maintained extension which does the same thing, which I have somehow missed and should use instead? If not:
  2. Is there a way of inserting separators into custom context menus? The old .desktop files used _SEPARATOR_ in the Actions= key, but the validator complained about the underscores not being valid, and the service menus only worked when I removed these entries. I can’t find any documentation about menu separators anywhere
  3. What is the correct location for installing the .desktop files? The guide I linked above suggests ~/.local/share/kio/servicemenus, which does work for me. However the (non-functional) installer script calls kf5-config --path services to find a location. On my kubuntu machine, this has the following output: /home/barnaby/.local/share/kservices5/:/usr/share/kservices5/. The first location listed doesn‘t exist, the second value is deprecated according to the guide I linked above, and the working location I actually use isn’t there at all. This is very confusing.
  4. What is the correct location for installing the binary which actually does the work and is called from the service menu Exec keys? The installer tries to put it in $HOME/bin, which doesn’t exist on my machine and isn’t in my $PATH so wouldn’t work anyway. When the binary is in ~/.local/share/bin, I can run it in my terminal but it can’t be called from dolphin. I ended up putting it in /usr/local/bin/ — is this a reasonable and generalizable decision?
  5. Is there a way for service menus to declare dependencies? Is it as simple as putting an apt-get install command in the install script (which would only work on Debian-derived systems)? What are the best practices for this? Currently the plugin just makes dialog boxes saying “Couldn’t find software x, please install it!” when you try to do anything with it. Would be nice to either do this automatically or at least do the checks earliest on install rather than on use.

Impractical meta questions and frustrated rants

  1. desktop-file-validate complains about errors even on working service menu files. It doesn‘t seem to differentiate between warnings and errors, and it complains about many things which are apparently required for KDE service menus to work (e.g. Services having an Exec key). What’s up with that?
  2. Why has what’s permissable in the .desktop format changed so much, apparently with no consideration for back compatibility? It looks like at some point underscores were suddenly no longer accepted within desktop action IDs (and _SEPARATOR_ disappeared or changed with them), which broke this very popular plugin. Why?
  3. It’s possible to install custom servicemenus and plugins via Discover and Dolphin, but it doesn’t look like there’s any way to specify which versions of KDE the service works with, and no user-facing way of debugging issues. Before I started digging around, I tried every user-facing GUI method of installing the service menu I could find, and all failed silently. When I moved the files into place myself, it failed silently. Are there any plans to improve this situation so that it might be usable for people who aren’t prepared for and capable of spending hours digging into the weeds so that they can right click on some images and make them smaller? I am happy to file bug reports with specific suggestions if they’re welcome. I love how easy KDE can (or in this case could) make it to do cool customizations like this but all these issues are very demoralizing.

System version information:
Dolphin 23.08.1
Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.0-14-generic (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® Graphics

I don’t have any issues with reimage, none.Both manual installs or, since I’m on deb packs, the deb package always installed without any probs. Been using it ever since it was released. Dunno what you consider “modern” kde, but I’m on plasma 5.27.
Majority of the services sits in /usr/share/kservices5 and the kdialog in /usr/bin.

Very interesting! I’m also on Plasma 5.27.8, and KDE frameworks 5.110.0.

Where did you get the .deb from? I tried downloading the .deb from within Dolphin and it failed silently just like everything else.

I’d also be curious to see what output you get from running desktop-file-validate /usr/share/kservices5/ServiceMenus/reimage-compress-resize.desktop

The deb is on the store.

About that command, I’m not sure it’s the correct one, but the entry is there alright.

Okay, I can confirm that downloading the .deb from that location manages to install the .desktop files to /usr/share/kservices5/ServiceMenus, but running desktop-file-validate complains about the exact same errors which prevented them from working for me:

reimage-compress-resize.desktop: error: value "progressive;optimize;_SEPARATOR_;compress_50;compress_70;compress_75;compress_80;compress_90;custom_compress;_SEPARATOR_;resize_25;resize_50;resize_75;_SEPARATOR_;300x225;600x450;800x600;1024x768;1200x900;1400x1050;1920x1080;custom_resize;_SEPARATOR_;" for key "Actions" in group "Desktop Entry" contains invalid action identifier "_SEPARATOR_", only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action compress_50", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action compress_70", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action compress_75", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action compress_80", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action compress_90", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action custom_compress", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action resize_25", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action resize_50", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action resize_75", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: file contains group "Desktop Action custom_resize", which has an invalid action identifier, only alphanumeric characters and '-' are allowed
reimage-compress-resize.desktop: error: key "Actions" is present in group "Desktop Entry", but the type is "Service" while this key is only valid for type "Application"
reimage-compress-resize.desktop: error: key "MimeType" is present in group "Desktop Entry", but the type is "Service" while this key is only valid for type "Application"
reimage-compress-resize.desktop: error: key "TryExec" is present in group "Desktop Entry", but the type is "Service" while this key is only valid for type "Application"
reimage-compress-resize.desktop: error: action group "Desktop Action 1920x1080" exists, but there is no matching action "1920x1080"
reimage-compress-resize.desktop: error: action group "Desktop Action 800x600" exists, but there is no matching action "800x600"
reimage-compress-resize.desktop: error: action group "Desktop Action 600x450" exists, but there is no matching action "600x450"
reimage-compress-resize.desktop: error: action group "Desktop Action 1024x768" exists, but there is no matching action "1024x768"
reimage-compress-resize.desktop: error: action group "Desktop Action 1400x1050" exists, but there is no matching action "1400x1050"
reimage-compress-resize.desktop: error: action group "Desktop Action 300x225" exists, but there is no matching action "300x225"
reimage-compress-resize.desktop: error: action group "Desktop Action 640x480" exists, but there is no matching action "640x480"
reimage-compress-resize.desktop: error: action group "Desktop Action 1200x900" exists, but there is no matching action "1200x900"

For me, the context menu items don’t show up until I’ve removed all the _SEPARATOR_ entries, removed all underscores from action IDs and removed the TryExec key

But good to hear that this still works as-is for some people I suppose…

Well, dunno what to tell you. Exact same file. On a sidenote and it depends on what you want of course, but there’s also kde-servicemenu-kim5. Just sayin’.
Btw, I just noticed you’re on 23.10. Personally, I skipped that one in a long line of kubuntus. Tried a couple of iso’s and with a couple of differences, they all had the weirdest issues.

But for the sake of it, I gave it a try on some remaining 23.10. No issues whatsoever.

Very weird. Well, I suppose I’ll put my maintenance efforts on hold until it‘s clear whether this is actually a problem for anyone else.

Yeah, let me rephrase that last one. It does pop up the same error stuff in a terminal but I enabled a couple of other compress/resizes and they do work. Weird stuff happening in that .10.


~/.local/share/kio/servicemenus is correct. Though if you have not installed any service menus before it won’t have been created yet.

What is the correct location for installing the binary which actually does the work and is called from the service menu Exec keys? The installer tries to put it in $HOME/bin, which doesn’t exist on my machine and isn’t in my $PATH so wouldn’t work anyway. When the binary is in ~/.local/share/bin, I can run it in my terminal but it can’t be called from dolphin. I ended up putting it in /usr/local/bin/ — is this a reasonable and generalizable decision?

Anything that’s in PATH will work. Note that this means the PATH that the dolphin process sees, not what your terminal sees

desktop-file-validate complains about errors even on working service menu files. It doesn‘t seem to differentiate between warnings and errors, and it complains about many things which are apparently required for KDE service menus to work (e.g. Services having an Exec key). What’s up with that?
Why has what’s permissable in the .desktop format changed so much, apparently with no consideration for back compatibility? It looks like at some point underscores were suddenly no longer accepted within desktop action IDs (and SEPARATOR disappeared or changed with them), which broke this very popular plugin. Why?

Don’t use desktop-file-validate for this. It is not designed to validate this kind of file and doesn’t understand the KDE-specific aspects of it

Good to know – is there a KDE-specific validator, or at least documentation for which properties KDE uses and for what? I haven’t been able to find any.

I’m not aware of a validator for service menu files. Creating Dolphin Service Menus | Developer should describe all relevant properties