How to add service menu entry in Dolphin.

Feb 10th, 2010 | Filed under gentoo, problems

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.

  1. John
    Feb 12th, 2010 at 21:47
    Reply | Quote | #1

    The exec command wasn’t working for me and this was the second solution I tried for this. I was able to combine this and the old one into a working config for my dolphin (this creates another action for the right click menu):

    File:

    ~/.kde/share/kde4/services/email.desktop

    Contents:

    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[]=Send file as attachment
    Icon=/usr/share/thunderbird/icons/mozicon16.xpm
    Exec=thunderbird -P guest -compose “attachment=file://%U”

  2. admin
    Feb 12th, 2010 at 22:10
    Reply | Quote | #2

    The question is does it work for multiple files?
    According to http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29 it should not.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image