For a strange reason since I first installed Debian Jessie with Konqueror 4.0.x ( or 3.5.x can’t remember ) on my laptop, it was missing some options in the Service Menu ( the right-click menu ) for zip archives ( extract, compress, … ). Even after upgrading to Debian Stretch and KDE 4.1.x the feature kept missing. And yes I was pretty sure about a missing feature, since this service option was available in other distros like Ubuntu and Slackware.
It is common with Linux that when we need to setup something, we just have to modify the configuration file or create one with some specific options in it.
The same applies here too and besides that, the Konqueror Service Menu is a pretty flexible menu. We can add an action for whatever we can imagine, whatever we find handy to appear on the right-click menu.
I present you two example scripts that I use on a daily basis and can be used as reference for creating various actions. The end result should look like this on your desktop.
Service Menu action for archives using ark
In this case we need to add a file, give it a name ending in .desktop for example archive_options.desktop and place it in the user home folder in the following path:
/home/username/.kde/share/kde4/services/archive_sm_options.desktop
Then we need to edit the file with our favorite editor, like nano and add the following script that supports extract, extract to a folder and compress features. The script uses ark, which needs to be installed in your system.
[Desktop Entry] Type=Service ServiceTypes=KonqPopupMenu/Plugin MimeType=application/octet-stream;inode/directory Actions=extract;extractTo;compress [Desktop Action extract] Name=Extract Here Icon=ark Exec=ark --batch %f [Desktop Action extractTo] Name=Extract To... Icon=ark Exec=ark -b -d %f [Desktop Action compress] Name=Compress Icon=ark Exec=ark -d --add %F
Service Menu action for resizing images
Another example of a Service Menu option I use on a daily basis, is to add an option to resize images to a set size. The script uses mogrify, a tool from ImageMagick suite.
Again for this we need to add a new file under the path:
/home/username/.kde/share/kde4/services/
edit the file and add the following script.
[Desktop Entry] Type=Service ServiceTypes=KonqPopupMenu/Plugin MimeType=image/*; Actions=resize750x750 [Desktop Action resize750x750] Name=Resize to 750x750 Icon=image-x-applix-graphics Exec=mogrify -resize "750x750>" %f
This script will resize the selected image or images 😉 to 750×750 pixels. So far I’ve used it for up to 50 images and it resized them all simultaneously without issues, IMO that would depend on the original image size and the system resources.
Documentation Reference
Other useful examples can be found in the KDE Techbase site.
Do you have any suggestions for other handy actions?
Suggest them with a comment.
Leave a Reply