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 module/application.

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 /usr/local/bin/gimp
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 be:

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

or:

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

So far I have tested this with the following applications:

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 overriden

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.

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*)

KGTK_DEBUG=0x10 kgtk-wrapper lowriter

10. If LibreOffice is detected (app is libreoffice, lowriter, etc.) then also set the OOO_FORCE_DESKTOP env var to gnome, so that we get nicer
themeing.
11. When passing filters to KFileDialog, replace / with \/
12. Make filter combo non-editable.
13. When returning selected filter to Gtk app, also return the filter name and not just the file pattern. This way if two filters have the same file pattern the corrent one can be selected.
14. Support for checkbox custom widgets.
15. Save location history per app.

Updated README?

I see that this app was last updatedin March 2009, but the readme still references Firefox <=1.5 only, so I have my doubts as to the accuracy of the rest of the information. What apps are known to work, and more importantly, what apps are still known to be problematic? Does Abiword work yet?

Furthermore, I have been STFW for a 32-bit KDE-4 Ubuntu deb file of this, but cannot find one. Does anyone know where to find such a beast?

Thanks!

Apps losing focus?

I noticed there were a few other comments about this, but no prescribed solution. I'm running KDEmod 3 (Arch Linux) and kgtk 0.10.0 from my distro's repository. I've got Swiftweasel (essentially optimized Firefox) running and KGTK works great, with the exception that whenever a file dialog is opened the window loses focus. This is the only thing that's really keeping me from wanting to use Firefox in a KDE environment, and it happens with GIMP too. Any ideas how to fix? Does 0.10.1 fix this?

Also, I'm using 0.10.0 because it works with KDE 3 dialogs. Will upgrading to 0.10.1 remove this ability?

So reading the readme (I should have done that first! :) ) I was able to compile 0.10.1 with KDE3 support. This still doesn't fix it, so I'd still like to hear any suggestions if there are any.

Re: Apps losing focus?

After playing around for a bit, I've found out that it depends on whether or not Compiz Fusion is running. Without it, the dialogs open fine. With it, however, the app in question loses its focus. I tried fooling around with QWidget::raise() and QWidget::setActiveWindow() to no avail. Disabling the focus-stealing capabilities of Compiz also has no effect. Still looking for a solution, I'll post back if I find one.

However, sometimes, but it's very rare that kgtk works, and there is happiness.

That is unfortunate, because I'm computer trainer in my company and I wish I could convince my colleagues to switch to linux, specifically on kde4. Unfortunately, once they see the dialog box instead of gtk kde4, they tell me that linux is not yet mature, because the dialog boxes are not the same as logiciles used.
It is a pity, because it's really the only thing which put off a lot, and I understand.

Thank you in advance for your help so that I can really make the promotion of linux (especially KDE) with a single dialog box regardless of the applications.

Re: Re: kdialogd4 crash

After compiling kgtk, it did not work.
So I decided to install kgtk via launchpad, but the result is always the same: kgtk does not work with kde4, at least for me. I think there is a communication problem with kdialog as kdialogd4 spits since its inception.
I tried reinstalling linux completely, but without effect.
I think it would be sufficient to some changes in kgtk so that it works properly, but unfortunately nobody has been able to bring me a solution.

Re: Re: Re: kdialogd4 crash

Kkgtk works with kde4 for me. Here are 'detailed' instructions for kubuntu jaunty:
-Add folowing repository to the /etc/apt/sources.list :
deb http://ppa.launchpad.net/kgtk/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/kgtk/ppa/ubuntu jaunty main

- To start Firefox with kgtk write:
kgtk2-wrapper firefox

and do the same in default application section of system settings.

With this firefox will always start with kgtk wrapper.
-------------------------------
I want to help you because it is a shame not to use this with kde. I was so happy when I figured this out, because i had a bug with gtk file picker and it kept crashing gtk applications.

If you have any more questions please ask them. Also read the README file in source archive, it explains a lot.

kdialogd4 crash

That is exactly what I did, on multiple PC and the result is always the same.
For against, I made an installation with kubuntu alternate and not conventional.
With that version as you do your installation?

Erratic behavior with Compiz

Hello. I have Kubuntu 9.04 64bit and KDE 4.3 with Compiz. Kgtk from launchpad repository.
When I open a KDE file dialog in GTK app, the dialog is not opened to the front and GTK app loses focus, while others opened apps are brought to the front.
In Compiz Settings, "general options" > "Focus & Raice Behaviour" turning off "focus-prevention-level" the situation improves, but only sometimes.
Do you know a setting on Compiz or other way to solve this problem?
Thanks!

How do you like Plasma 5? The best KDE Desktop ever. Definitely a nice improvement. Not decided yet. Haven't tried it yet. I do not like some of the changes. KDE is taking the wrong way. I am still sticking with KDE 3.5. I have no opinion, but wanted to vote anyway.

Copyright 2003-2015 KDE-Apps.org Team All rights reserved. KDE-Apps.org is not liable for any content or goods on this site.All contributors are responsible for the lawfulness of their uploads.KDE and K Desktop Environment are trademarks of KDE e.V.