Chapter 5, KDE Desktop
#41 Make KDE Even Easier to Use
The next line is a bit tricky. Each time you launch an instance of kwrite,it
gets a DCOP listing with a number attached to it. You want to address the
most recently launched copy of kwrite, so the script runs dcop to list all
DCOP applications, finds all the applications that match “kwrite,” sorts the
list, and picks the last entry. That entry’s name is assigned to the variable
$kwid. This works even if this is the first instance of kwrite you have
Then the script issues a few DCOP instructions. It automatically enters the
first line of a typical bash script, #!/bin/bash, after which it enters two more
blank lines and moves the cursor to the last blank line.
Now create the bash script that gets you started writing a Python script. The
only difference between /usr/local/bin/writeBashScript and /usr/local/bin/
writePythonScript is that you will insert the first line as the full path to your
Python interpreter instead of
#!/bin/bash. That line of code should look like
dcop $kwid EditInterface#1 insertText 0 0 '#!/usr/bin/python'
Obviously, there’s no limit to the kinds of templates you can create for vari-
ous scripting languages.
These examples barely scratch the surface of what you can do. You can cre-
ate a single menu entry that lets you select a half dozen directories, tar and
compress them, and burn them to a multisession CD, all in one fell swoop.
And you have the flexibility to do this as a bash script, as a Python script, or
in any method you prefer. You’ll be surprised at how much more you rely
on the GUI interface of KDE once you have customized menu features for
your personal convenience.
Make KDE Even Easier to Use Hack #41
Beautify and enhance the usability of KDE by patching it with experiment
This is actually a combination of code hacks that improve KDE in several
ways. Some of the changes are purely cosmetic, but some enhance the
usability of KDE, especially the sidebar in the Konqueror file manager and
web browser. This collection of hacks makes the practically indecipherable
design of the sidebar thoroughly intuitive. It also makes selecting files a
more pleasant experience and spruces up a few parts of the KDE interface.
André Moreira Magalhães (andrunko@yahoo.com.br), a 24-year-old com-
puter science graduate from Brazil, has provided a pack of incredibly cool
KDE hacks via http://www.kde-look.org for KDE 3.3.1. Some of André’s
patches are modified and ported from hacks written by Aviv Bergman (aviv_
Make KDE Even Easier to Use #41
Chapter 5, KDE Desktop
As I write this, KDE 3.3.2, a bug-fix release to KDE 3.3.1, is
being launched. I have downloaded and applied the patches to
the KDE 3.3.2 source code, and they apply cleanly (though
occasionally you might receive a message that the patch was
offset by a few lines, which is a warning you can usually
ignore). So far, the patches seem to work fine with KDE 3.3.2,
although I have not had the time to give KDE 3.3.2 a thor-
ough workout. It is possible, and even likely, that an updated
patch set for KDE 3.3.2 will be available on http://www.kde-
look.org by the time you read this.
KDE 3.4 is due to be available by mid-March 2005, and that
release might incorporate some of the hacks documented
here. If not, keep an eye on http://www.kde-look.org for new
patches for these features.
Figure 5-5 shows what Konqueror looks like before the enhancements, and
Figure 5-6 gives you an idea of most of the changes these hacks will make to
KDE 3.3.1 Konqueror.
I assume you already compiled and installed KDE 3.3.1. If you still have the
source code on your hard drive, this will make things easier. If not, get the
source code for the following portions of KDE, and unpack it where you will
Figure 5-5. Konqueror without enhancements
Chapter 5, KDE Desktop
#41 Make KDE Even Easier to Use
compile it. For this example, I am assuming you will work in the /usr/local/
src directory. You need to have the source code installed for the following
packages, which are listed in the order in which you will compile and install
Qt 3.3.3
kdelibs 3.3.1
kdebase 3.3.1
kdeartwork 3.3.1
For more detailed instructions on how to build and install all of KDE 3.3.1,
see http://www.kde.org/info/3.3.1.php and/or “Run KDE on the Bleeding
[Hack #44].
Once you have the preceding source code ready, download the hacks from
http://www.kde-look.org/content/show.php?content=16962. You want to
download the 16962-patches-1.0.0.tgz file.
Figure 5-6. Konqueror with enhancements

Get Linux Desktop Hacks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.