KDE 4 Service Menu Editor

You would have thought that it would be possible to edit the KDE Service Menu (the menu that you see when you right-click on an entry in a Dolphin or Konqueror window) or add your own commands to it. However, this is not a feature of KDE 4 to date (June 2011). Fortunately, KDE developer David Edmundson produced a handy GUI utility to do just this. His blog post KDE Service Menu Editor and KDE-Apps.org entry give the details.

I hope this utility will become part of KDE in a future release, but, until it does, below I explain how I installed it in KDE 4.6.2 for Sabayon Linux. The same procedure should apply in the case of Gentoo Linux.

1. Download kservicemenueditor-0.2a.tar.gz and extract it to ~/kservicemenueditor-0.2a/

2. N.B. This step is distribution-dependent, and may not be necessary for your distribution. Use the following command to determine whether or not you need to perform this edit:

$ kde4-config --path data

If the above command returns the following paths:


then edit setup.py and change the line:

('share/kde4/apps/servicemenueditor', glob.glob("*.ui")),


('share/apps/servicemenueditor', glob.glob("*.ui")),

3. To install KDE Service Menu Editor:

$ cd ~/kservicemenueditor-0.2a/
$ su
# ./setup.py install
# exit

4. To launch the utility, either run it on the command line from your normal user account:

$ servicemenueditor

or double-click the Desktop Configuration File servicemenueditor.desktop (which you can place on your Desktop or in any other directory).

5. Usage example:

Let’s assume you want to make a right-click menu for compressing a file with GZip. In that case you would carry out the steps listed below.

a) Launch servicemenueditor.
b) Click ‘Add’.
c) In the box type the name “compress” (without the quotes) and click ‘OK’.
d) Click on the ‘Conditions’ tab and select ‘All Files’ as you want to be able to work on all files.
e) Click the ‘Action’ tab and enter “Compress Files” (without the quotes) in the ‘Label’ box. This is what will appear in the ‘Actions’ Menu.
f) Click on the blank icon and select an icon of your choice.
g) In the ‘Exec’ box, type the command needed. For this example “gzip %u” would be the command.

Help for Windows users: How to create a Linux LiveCD, LiveDVD or LivePenDrive from an ISO file

Existing Linux users are completely familiar with ISO image files, LiveCDs and LiveDVDs, but a newcomer to Linux may have never heard of ISO files, let alone created a LiveCD or LiveDVD. I was reminded of this yesterday when a confused Windows user contacted me to ask how to create a LiveCD, so I thought I’d post the instructions here as they may help other Windows users wanting to create a bootable LiveCD, LiveDVD or pen drive in order to try Linux without installing it, or indeed to use to install Linux to their hard drive.

In this particular case the Windows user wanted to create a LiveDVD for 64-bit Sabayon Linux 5.5 KDE Edition, so I oriented my instructions to Sabayon Linux. But the procedure is essentially the same for other Linux distributions that release ISO files for the creation of LiveCDs or LiveDVDs.

Below I cover two options: the creation of a bootable ‘Live’ optical disc (be it a CD or a DVD), and the creation of a bootable ‘Live’ pen drive. Steps 1 to 3 below are common to both options.

1. Download e.g. the ISO file for 64-bit Sabayon Linux 5.5 KDE Edition from one of the repository mirrors listed on the Sabayon Linux Web site’s Download page. For example: http://na.mirror.garr.it/mirrors/sabayonlinux/iso/Sabayon_Linux_5.5_amd64_K.iso

2. Find the MD5 checksum of the ISO file you downloaded. In Windows you can do this by using e.g. the freeware GUI utility WinMD5sum.

3. Visually compare the MD5 checksum with the MD5 checksum listed in the .md5 file for the ISO file you downloaded in Step 1 (some distributions just list the MD5 checksum on the Download page, rather than issuing a file). For example: http://na.mirror.garr.it/mirrors/sabayonlinux/iso/Sabayon_Linux_5.5_amd64_K.iso.md5

If they differ then the downloaded ISO file is corrupt, so go back to Step 1, otherwise proceed to Step 4.

Option A: How to create a LiveCD/DVD via Windows

If the ISO file size is less than the capacity of a CD-R (usually 650 MiB, but check on the media box or disc label) then use a CD-R. If the ISO file size is bigger than the capacity of a CD-R then use a DVD-R. If you burn to a CD-R then you will create a ‘LiveCD’; if you burn to a DVD-R then you will create a ‘LiveDVD’. Even if the ISO file is smaller than the capacity of a CD-R, there is nothing stopping you using a DVD-R instead of a CD-R if you wish.

4. Burn the ISO file to a blank optical disc, but not as a data file: you need to select the ‘Burn Image’ or ‘Burn ISO’ option in your burning utility. Optical media and optical drives are notoriously fickle, so burn using a low speed e.g. x1 or x2 in order to maximise the chance of a good burn. There are many commercial and freeware burning utilities for burning to CD-R and DVD-R. Commercial burning utilities include well-know applications such as Nero and Roxio. There are also many freeware burning utilities which you can find using e.g. Google. The Sabayon Linux Wiki article HOWTO:_Burn_Sabayon_from_Windows recommends the freeware burner ISO RECORDER but you can also find others using Google.

Many burning utilities have a Verify option to check that the burn was successful. If the utility you use does have such an option, select it. If it does not have a Verify option, there are other ways of checking the burnt CD/DVD in Windows (and Linux) if you want to. For example, see Method 3 in Sabayon Linux Wiki article HOWTO: Checking the integrity of a LiveCD or LiveDVD.

5. Boot the LiveCD/DVD to see if it works. You may need to configure your computer’s BIOS to boot first from an optical drive, or your computer may have a boot menu option which lets you select which drive to boot.

Option B: How to create a LiveCD/DVD on a pen drive (I call this a ‘LivePenDrive’) via Windows

This is only viable if your computer has a BIOS option to boot from USB pen drives, or a boot menu option to boot from USB pen drives. Legacy computers did not have these options, so, if you have an old computer that cannot boot from a pen drive, your only option would be to create a ‘Live’ optical disc.

4. Download the utility UNetbootin for Windows, and install it.

5. Run UNetbootin to create the LivePenDrive using the ISO file you downloaded. In the UNetbootin GUI window, don’t tick ‘Distribution’, tick ‘Diskimage’. Then select ‘ISO’, browse (use the ‘…’ button) to the folder containing the ISO file and select it. Make sure you have selected Type: ‘USB Drive’, and Drive: the drive letter for the pen drive. The pen drive will probably be D:\ or E:\ but, if you are not sure, check in Start > Computer (Start > My Computer if you are using Windows XP).

6. Boot the LivePenDrive to see if it works. You may need to configure your computer’s BIOS to boot first from a pen drive, or your computer may have a boot menu option which lets you select which drive to boot.

The beauty of using a pen drive is that you can overwrite its contents in future if you want to create a LivePenDrive of a newer version of the same Linux distribution or a different distribution. Unlike a CD-R or DVD-R, which will probably end up being thrown away when a new version of the ISO is released. Another advantage of using a pen drive is that the creation of a LivePenDrive is more reliable than burning an optical disc. It is not uncommon to end up with a corrupted optical disc, which is just a waste of plastic.

Converseen, a GUI batch image converter and resizer using Qt4 and ImageMagick

I normally use ImageMagick on the command line to convert and/or resize my photographs, and the two commands I use are convert and mogrify. However, I learned recently of Converseen, a GUI tool for batch conversion and resizing of image files which is a front-end for ImageMagick. Although it’s easy enough to use the command line, a GUI tool does save having to remember the command syntax each time, so I thought I’d install Converseen in Gentoo. Converseen is not in the main Portage tree, but I found an ebuild for version 0.2 from the qting-edge overlay. However, rather than add the overlay I decided instead to use a local overlay to install Converseen, which is currently at version 0.4.1, and the procedure I used is given below.

1. I downloaded to ~/Desktop/ the ebuild file from http://gitorious.org/gentoo-qt/qting-edge/blobs/master/media-gfx/converseen/converseen-0.2.ebuild and renamed it as converseen-0.4.1.ebuild, which contains the following:

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $



inherit qt4-edge


DESCRIPTION="GUI image conversion tool based on imagemagick"

KEYWORDS="~amd64 ~x86"

|| ( media-gfx/graphicsmagick[imagemagick] media-gfx/imagemagick )"



src_prepare() {

sed -i -e "s!/usr/lib!/usr/$(get_libdir)!" ${PN}.pro \
|| die "sed libdir failed"

local ts_files=
for lingua in ${LINGUAS}; do
for a in ${LANGSLONG}; do
if [[ ${lingua} == ${a%_*} ]]; then
ts_files="${ts_files} loc/${PN}_${a}.ts"
local qm_files="${ts_files/.ts/.qm}"

sed -e '/^ loc/d' \
-e "s!\(TRANSLATIONS += \).*!\1${ts_files}!" \
-e "s!\(translations\.files = \).*!\1${qm_files}!" \
-i ${PN}.pro || die "sed translations failed"

2. I downloaded to ~/Desktop/ the file qt4-edge.eclass, which contains the following:

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: qt4-edge.eclass
# Ben de Groot ,
# Markos Chandras ,
# Davide Pesavento ,
# Dominik Kapusta
# @BLURB: Experimental eclass for Qt4 packages
# This eclass contains various functions that may be useful when
# dealing with packages using Qt4 libraries. Requires EAPI=2.

inherit base eutils multilib qt4-r2 toolchain-funcs

export XDG_CONFIG_HOME="${T}"

qt4-edge_pkg_setup() {
if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
ewarn "Please file bugs on bugs.gentoo.org and prepend the summary with"
ewarn "[qting-edge]. Alternatively, contact qt@gentoo.org."
ewarn "Thank you for using qting-edge overlay."
ebeep 5

qt4-edge_src_unpack() {
debug-print-function $FUNCNAME "$@"

qt4-r2_src_unpack "$@"

# @FUNCTION: qt4-edge_src_prepare
# Default src_prepare function for packages that depend on qt4. If you have to
# override src_prepare in your ebuild, you should call qt4-edge_src_prepare in it,
# otherwise autopatcher will not work!
qt4-edge_src_prepare() {
debug-print-function $FUNCNAME "$@"


# @FUNCTION: qt4-edge_src_configure
# Default src_configure function for packages that depends on qt4. If you have to
# override src_configure in your ebuild, call qt4-edge_src_configure in it.
qt4-edge_src_configure() {
debug-print-function $FUNCNAME "$@"


# @FUNCTION: qt4-edge_src_compile
# Default src_compile function for packages that depends on qt4. If you have to
# override src_compile in your ebuild (probably you don't need to), call
# qt4-edge_src_compile in it.
qt4-edge_src_compile() {
debug-print-function $FUNCNAME "$@"


# @FUNCTION: qt4-edge_src_install
# Default src_install function for qt4-based packages. Installs compiled code,
# documentation (via DOCS variable) and translations (via LANGS and
# LANGSLONG variables).
qt4-edge_src_install() {
debug-print-function $FUNCNAME "$@"


# install translations # hwoarang: Is this valid for every package???
# need to have specified LANGS or LANGSLONG for this to work
[[ -n "${LANGS}" || -n "${LANGSLONG}" ]] && prepare_translations

# Internal function
_do_qm() {
debug-print-function $FUNCNAME "$@"
[[ $# -ne 2 ]] && die "$FUNCNAME requires exactly 2 arguments!"

local transfile="$(find "${1}" -type f -name "*${2}".qm)"
if [[ -e ${transfile} ]]; then
INSDESTTREE="/usr/share/${PN}/${1#${S}}" \
doins "${transfile}" \
|| die "failed to install ${2} translation"
eerror "Failed to install ${2} translation. Contact eclass maintainer."
die "Failed to install translations"

# @DESCRIPTION: Translations directory. If not set, ${S} will be used

# @FUNCTION: prepare_translations
# Choose and install translation files. Normally you don't need to call
# this function directly as it is called from qt4-edge_src_install.
prepare_translations() {
debug-print-function $FUNCNAME "$@"

# Find translations directory
# Changed default to . - crazy upstreams :)
local roottrdir="${TRANSLATIONSDIR:-${S}}" trdir=.
for dir in lang langs translations; do
[[ -d ${roottrdir}/${dir} ]] && trdir="${roottrdir}/${dir}"

local lang=
for lang in ${LINGUAS}; do
for x in ${LANGS}; do
[[ ${lang} == ${x%_*} ]] && _do_qm "${trdir}" ${x}
for x in ${LANGSLONG}; do
[[ ${lang} == ${x} ]] && _do_qm "${trdir}" ${x}

EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install

3. I synchronised the Portage main tree’s ebuilds on my PC with those in the repositories:

# emerge --sync

4. I made sure that /etc/make.conf has the following lines at the end of the file:

PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage/"

5. I created the necessary directories in the local overlay:

# mkdir -p /usr/local/portage/media-gfx/converseen
# mkdir -p /usr/local/portage/eclass

6. I made sure Portage would not nag me about a missing name for my local overlay:

# mkdir /usr/local/portage/profiles
# echo "local_overlay" > /usr/local/portage/profiles/repo_name

7. I copied the converseen ebuild and eclass file into the relevant directories:

# cp /home/fitzcarraldo/Desktop/converseen-0.4.1.ebuild /usr/local/portage/media-gfx/converseen/
# cp /home/fitzcarraldo/Desktop/qt4-edge.eclass /usr/local/portage/eclass/

8. I generated the manifest for the package:

# cd /usr/local/portage/media-gfx/converseen/
# ebuild converseen-0.4.1.ebuild manifest

9. I merged the package:

# emerge -1v converseen

An entry for Converseen was added to Kickoff > Applications > Graphics, and I can either use that to launch it or I can launch it from the command line by entering the command converseen. The user interface is easy to master, and I’ve already put Converseen to use at work and at home. Overall, then, a useful addition to my KDE toolkit.

EDIT (July 23, 2012}: There is an ebuild for Converseen in Portage these days, so use that instead to install Converseen.


Get every new post delivered to your Inbox.

Join 43 other followers