More Fun with KDE Service Menus

Dmitri Popov

Productivity Sauce

Jan 17, 2014 GMT
Dmitri Popov

Using the service menus feature in KDE, you can add all kinds of useful commands to the Actions entry of the context menu. The previous post demonstrated how you can add Déjà Dup-related commands to restore missing files and revert a file to a previous version. Of course, you can put the service menus feature to other clever uses, too. For example, I usually resize photos before publishing them on the web using the convert tool in ImageMagick. But instead of switching to terminal and running the convert foo.jpg -resize 1600x1600> foo.jpg command manually every time I need to shrink a photo, I created a service menu that allows me to quickly resize images from the convenience of the Dolphin file manager. I created the ~/.kde4/share/kde4/services/ServiceMenus/resize-large.desktop file and added the service menu definition below:

[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=image/png;image/jpeg;image/png;image/JPG;image/png;image/jpg;
Actions=ResizeLarge
[Desktop Action ResizeLarge]
Name= Resize 1600x1600>
Exec=convert %f -resize "1600x1600>" %f
Icon=image-x-applix-graphics

To limit the menu to specific image formats, I specified them in the MimeType part. I also assigned an icon to the menu entry using the Icon variable.

If you are interested in learning more about how to create service menus, the Creating Konqueror Service Menus article on KDE TechBase and the Create Your Own Custom KDE Service Menu tutorial offers a lot of useful info on the subject.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News