Custom KDE Service Menus
It is very easy to add a custom menu in KDE. You do not need real programmer skills or a degree in computer science.
I will explain by example here how to add a menu to convert a youtube
*.flv file to a regular
First off lets find where KDE hides these service menus. Open up dolphin and open the
Look down and select
Show Hidden Files.
Then find the directory folder called
.KDE is a directory folder to store all the service menu entries.
They are a special type of
*.desktop file, whose contents look similar to a tiny
Find Files Tool to search for
I say this because KDE changes over time,
but most annoying is that distro’s play around moving stuff.
Look for something like
Ignore stuff related to /share/apps/ , but do note that KDE uses
*.desktop files for things besides service menus.
Ok, if your like me, you will create a quick link to this hidden directory folder, to some where like your Projects directory, to avoid this hidden files problem.
Ok, well that is the worst bit over, now to the actual desktop file.
The actual desktop file is quiet self explanatory, it is in 4 sections, and gives two menu entries. If you copy paste this example, you can probably edit it to customize to do whatever you want. I could have given a 4 line example, but within seconds most people would want something more useful with sub-menu options.
If you copy paste this into
/share/kde4/services and then
right-click on a
and look under the
Actions menu you should be able to find a sub-menu called
Convert FLV video and then two menu options,
to choose between modern rectangular Wide Screen 16:9 or old fashioned square TV 4:3.
Take note, this menu will only appear if you click on an *.flv file, it will never appear on any other mimetype.
X-KDE-Submenu=Convert FLV video
[Desktop Action ConvertToMPEGwide]
Name=Convert flv video into 16:9 PAL-DVD mpg
Exec=ffmpeg -i %u -target pal-dvd -ac 2 -r 25.000 -s 720x576 -aspect 16:9 "%u.PAL-DVD.16:9.Q-defaults.mpg"
[Desktop Action ConvertToMPEGsquare]
Name=Convert flv video into 4:3 PAL-DVD mpg
Exec=ffmpeg -i %u -target pal-dvd -ac 2 -r 25.000 -s 720x576 -aspect 4:3 "%u.PAL-DVD.4:3.Q-defaults.mpg"
I think the only thing that needs a word of explanation is the %u if the Exec line – which when run will insert the file name into the Exec command line. The Exec line, is where the real work is done, it is where the command is invoked.
Of course if you are American, you would also want to change from PAL to what America uses, which is NTSC standard for TV and DVD stuff…
These *.desktop files have other uses, obviously you most often see them as shortcuts on your desktop. This is why I suggested you used the Find Files tool, to see where the critters hide. Take a little time, and read some of them, and you will rapidly clue in as to how they work and how it all fits together.
MPEG Format http://en.wikipedia.org/wiki/H.262/MPEG-2
FLV Format (Flash Video) http://en.wikipedia.org/wiki/Flash_Video
Custom "right-click" menu KDE Service Menus Wordpress Article