KGtk (Use KDE Dialogs in Gtk Apps) 0.9

Craig Drummond Craig.Drummond at
Tue Sep 11 09:44:24 CEST 2007

Name: KGtk (Use KDE Dialogs in Gtk Apps)
Version: 0.9
Type: KDE Improvement
License: GPL
More Info:

 This is a quick-and-dirty LD_PRELOAD hack that
allows *some* Gtk applications to use KDE's file
dialogs when run under KDE. 

The Gtk file chooser functions have been
overridden to communicate with this KDE

After compiling and installing this, you can run
Gtk applications in 2 ways:

A. call /usr/local/bin/kgtk-wrapper gimp

B. i. Create a symbolic link from the wrapper
script to your application, e.g.
       ln -s /usr/local/bin/kgtk-wrapper
   ii. Make sure /usr/local/bin is before /usr/bin
(or wherever gimp is installed) in your $PATH
   iii. Now simply run 'gimp' - this should find
the wrapper script first.

If this works OK, then edit the .desktop file
(e.g. /usr/share/applications/gimp.desktop) to
have "Exec=/usr/local/bin/[appname]"  instead of
"Exec=[appname]", e.g. for gimp.desktop this would

    Exec=/usr/local/bin/gimp-remote-2.2 %U


gimp-remote-2.2 %U

So far I have tested this with the following

1. Kino. Works perfectly - in fact Kino was my
main reason for doing this.
2. Firefox. Works with Firefox 1.5, but *not*
Firefox 1.0.x
3. GIMP. Again, seems to work just fine. However,
there is no progress bar on file loading - as GIMP
uses a progress bar embedded in the file chooser.
4. Inkscape. Works OK - at least 0.43
5. Streamtuner - the folder browser button works.
6. AbiWord - does *not* work. Don't even try...
7. Glade2. Seems to work OK, however I have had it
crash when loading Kino's .glade file, but not
always. So I'm not sure if this is Glade's fault,
or mine.
8. Eclipse. Will work only if dlsym can be

As the only Gtk apps I use are Kino, GIMP, and a
little of Firefox, this library works great for
me. Your millage may vary, and please note that
this is only a quick hack to get things working
now for me. I'm not sure how stable it will be
under heavy usage, so don't be surprised if it
breaks. However, if it does break - the only thing
that should happen is that the Gtk apps will fall
back to using the standard Gtk dialogs.

The 'Portland' freedesktop project will
undoubtedly come up with a far better solution.
But until then, you can give this a try.

p.s. Before anyone asks, as they always do:
Widget style: QtCurve, works for KDE and Gtk (also
does KDE->Gtk icon mapping). This is set on the
"Clear" variation.
Window decoration: Crystal with Knifty buttons
Font: Verdana. However, I have recompiled FreeType
with the TrueType byte encoder enabled - this give
great looking non anti-aliased fonts (otherwise
they look *horrible*)

1. Fix dialog parenting issues with Gtk folder
picker combo/menu.
2. Fix compilation issue for KDE < 3.4
3. Treat Iceweasel and Swiftfox the same as
4. Improve operation under beryl.
5. Add KDE4 and Qt4 support.
6. Reduce heavy CPU usage of kqt
7. Fix some i18n issues.
8. Place wrapper scripts into prefix/bin, and
libraries into prefix/lib/kgtk
9. kgtk-wrapper can now be called for Gtk2, Qt3,
and Qt4 apps. The app is checked to determine
which toolkit it is using. If this check fails,
you may edit ~/.kde/share/config/kgtkrc and add
lines such as


   Setting "abiword=x" disables kgtk for abiword
(as it doesnt work!)

More information about the Kde-announce-apps mailing list