Categories
gentoo problems

How to add service menu entry in Dolphin.

Peace of simple functionality I’ve been lacking for some time in dolphin was “send to ” option which would create an email with attached file(s) (many files). I have no idea why it does not exists “out of box” but there is quite simple way of adding this.

This descriptions applies to KDE4.
directory /usr/share/kde4/services/ServiceMenus

contains list of actions avaiable in Dolphin for various file types.
If you add file there an entry will appear in Dolphin (Settings -> Configure Dolphin, Services)
In order to Dolphin re-read content of this dir you have to change something in that window (check and uncheck any selectbox and press apply).

Ok. create email.desktop in mentioned dir:

[Desktop Entry]
Actions=attachToEmail
Encoding=UTF-8
ServiceTypes=KonqPopupMenu/Plugin,all/allfiles
ExcludeServiceTypes=application/x-iso,kdedevice/*,inode/directory
Type=Service

[Desktop Action attachToEmail]
Name=Attach to Thunderbird Mail
Name[en]=Send file as attachment
Name[]=Wyslij jako zalacznik
Icon=/usr/share/thunderbird/icons/mozicon16.xpm

#Exec=a.sh -compose “attachment=file:/$(echo %F | sed ‘s/\\ \\//,file:\\/\\//g’)”
# bactick operator also works
Exec=thunderbird -compose “attachment=’file:/`echo %F | sed ‘s/\\ \\//,file:\\/\\//g’`'”

Download above sample from here (if you copy above content directly from browser IT MAY NOT WORK)

As you see you can specify with which file types this context menu should appear.
Above configuration works for thunderbird 2.x (2.x requires files:// prefix, because of some bug)

There is a peace of magic in Exec line, because of the way thunderbirds expects filenames.

More about desktop file format here.