KGtk (Use KDE Dialogs in Gtk Apps)

Various KDE 1.-4. Improvements

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

11
7 .7
Description:

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*)
Last changelog:

9 years ago

0.11.0
------
1. Gtk3 support.
2. Better, and safer, lookup of file filters.
3. Correctly determine size of string needed for pidfile!
4. Add thunderbird, and LibreOffice apps, to list of gtk2 apps.
5. Cleanup usless stuff; remove kdialogd3, qt3, qt4, kgtk2-wrapper, kqt3-wrapper, kqt4-wrapper.
6. Merge kgtkXX-wrapper scripts into kgtk-wrapper
7. Install kdialogd4 into KDE4 libexec dir.
8. Fix crash where client is terminated whilst file dialog is open.
9. Configurable debug. Pass cmake -DKGTK_DEBUG=true
When starting app, set KGTK_DEBUG env var, e.g.

KGTK_DEBUG=0x10 kgtk-wrapper lowriter

0x01 Connection debug
0x02 General debug
0x04 Filter get and set debug
0x08 Filter creation debug
0x10 Custom widget debug
0x20 dlsym debug
Values may be combined

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.

jakuhr

13 years ago

Great it works. Thank you!

Report

C

CraigD

13 years ago

Please contact me via email, and I'll try and sort things out.

Report

PUNX69

13 years ago

can you add opera support for the kqt3-wrapper?

Report

C

CraigD

13 years ago

kqt3-wrapper works fine with opera. I think its kgtk-wrapper (the main one), which is not detecting opera as a Qt3 app. I'll fix this for the next release, but for now edit/create ~/.kde/share/config/kgtkrc to have the following:

[Apps]
opera=qt3


This will tell the kgtk-wrapper script to use the Qt3 LD_PRELOAD library for opera.

Report

PUNX69

13 years ago

yes it#s working but ever wenn i open anything opera is crashing

Report

C

CraigD

13 years ago

Yeah, I can confirm this :-(

...but, I think I've found a solution, and will do a new release soon (with some translations I hope...)

Report

haukew

13 years ago

Nice one - but could you build a current SuSE-rpm please?

Report

MamiyaOtaru

13 years ago

"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."

This no longer works. realApp=`which $app` returns /usr/local/bin/gimp, which is of course a link to kgtk-wrapper, so it goes into an infinite loop.

Older versions had code like

dir=`dirname $0`
oldPath=$PATH
PATH=`echo $PATH | sed s:$dir::g`
realApp=`which $app`
PATH=$oldPath

to temporarily remove /usr/local/bin from PATH to make sure $app is the actual gimp binary.

Editing the latest version to do the same thing gets it to work again.

ALSO (in better news) this works with qt4jambi (qt4's official java bindings) so one can write java programs with a qt4 GUI and KDE file dialogs. Great stuff :)

Report

pwt

13 years ago

Tried the 0.9.1beta and it works well both for gtk2 and qt4 apps under kde3. Thanks. Qt4 inclusion is definitively a step forward.

There is still a locale issue: the kdedialogd window is still in English only. This happened with 0.8 but not in 0.7 where it was shown in the selected kde locale. Would be fine if you could fix that.

Thanks again.

Report

blaster999

13 years ago

Hi! Has anyone made a gentoo ebuild yet? I tried but my ebuild-fu skills are weak (and I know nothing about cmake), so I failed...

Report

poliicallycorrect

13 years ago

EXCELLENT idea!!

Install ok
Get KDE dialog: ok
But no file loads....

ego@zob:/usr$ /usr/bin/kgtk-wrapper /usr/bin/gimp-2.4
kdialogd: New connection
kdialogd: new client...gimp-2.4 (17)
kdialogd: read
kdialogd: startDir:
kdialogd: KDialogDFileDialog::accept
kdialogd: KDialogDFileDialog::slotOk
kdialogd: ok
kdialogd: finished
kdialogd: ~KDialogDFileDialog

(KDE 3.5.7, Debian testing/unstable, gimp 2.4 rc2)

Report

C

CraigD

13 years ago

Is this 0.9 of kgtk? Or the test 1 posted above?

Anyway, I've not tested against gimp 2.4. As a quick test, try:

ln -s /usr/bin/gimp-2.4 /tmp/gimp

Then run /tmp/gimp

Report

poliicallycorrect

13 years ago

Thanks for reply
MANY thanks for quick reply!!!

...And it works! (don't know why & how, but it works!!!

Only a "directory not exists" (or so) message appears when I try to save, but I press "ok, it doesnt exist", and my file is saved...

Hope that Kgtk will someday work like a swiss watch (so boring Gtk/Gnome dialogs!!!...)

Here are the konsole messages:

ego@zob:~$ /usr/bin/kgtk-wrapper /tmp/gimp
kdialogd: Timeout:30
kdialogd: New connection
kdialogd: new client...gimp (16)
kdialogd: read
kdialogd: startDir:
kdialogd: KDialogDFileDialog::accept
kdialogd: KDialogDFileDialog::slotOk
kdialogd: ok
kdialogd: finished
kdialogd: ~KDialogDFileDialog
kdialogd: New connection
kdialogd: new client...jpeg (20)
jpeg-load: found EXIF block (13 bytes)
jpeg-load: found image comment (5 bytes)
kdialogd: read
kdialogd: Comms error, closing connection...20
kdialogd: close 20
kdialogd: Delete client
kdialogd: Deleted client

(gimp:4010): Gdk-CRITICAL **: gdk_window_raise: assertion `GDK_IS_WINDOW (window)' failed
kdialogd: read
kdialogd: startDir:/home/ego/Autres%20images/NK35-j2000.jpg
kdialogd: KDialogDFileDialog::slotOk
kdialogd: ok
kdialogd: finished
kdialogd: ~KDialogDFileDialog
kdialogd: New connection
kdialogd: new client...jpeg (20)
destroy_preview (1, -1)
destroy_preview (1, -1)
destroy_preview (1, -1)
destroy_preview (1, -1)
destroy_preview (1, -1)
jpeg-save: saving EXIF block (20 bytes)
jpeg-save: saving image comment (5 bytes)
kdialogd: read
kdialogd: Comms error, closing connection...20
kdialogd: close 20
kdialogd: Delete client
kdialogd: Deleted client
kdialogd: read
kdialogd: Comms error, closing connection...16
kdialogd: close 16
kdialogd: Delete client
kdialogd: Deleted client
ego@zob:~$ kdialogd: Timeout occured, and no connections, so exit

Report

C

CraigD

13 years ago

I knew trying to mix Qt3, KDE3, Qt4, and KDE4 would cause hassles :-(

Can you please try:

http://home.freeuk.com/cpdrummond/kgtk-0.9.1beta.tar.bz2

...and see if this helps? I've changed the build system to CMake. To compile you will need to do:

1. mkdir build
2. cd build
3. cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DKGTK_KDE3=true -DKGTK_GTK2=true -DKGTK_QT3=true
4. make
5. sudo make install


see the 'README' for more info.

Report

BorgQueen

13 years ago

Am I missing something? I'm running Ark Linux 2007.1 with all the devel packages installed.
Building using:
./configure --prefix=/usr
Any help would be appreciated (as it the app, thanks)

make all-recursive
make[1]: Entering directory `/home/Software/SoftwareTesting/kgtk-0.9'
Making all in kdialogd3
make[2]: Entering directory `/home/Software/SoftwareTesting/kgtk-0.9/kdialogd3'
kdialogd.h > kdialogd.moc
/bin/sh: kdialogd.h: command not found
make[2]: *** [kdialogd.moc] Error 127
make[2]: Leaving directory `/home/Software/SoftwareTesting/kgtk-0.9/kdialogd3'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Software/SoftwareTesting/kgtk-0.9'
make: *** [all] Error 2

Report

hrabex

13 years ago

make command gives me follows:

make[1]: Entering directory `/home/jan/install/kgtk-0.9/kgtk-0.9'
Making all in kdialogd3
make[2]: Entering directory `/home/jan/install/kgtk-0.9/kgtk-0.9/kdialogd3'
/bin/sh ../libtool --silent --tag=CXX --mode=link g++ -g -O2 -o kdialogd3 kdialogd.o -lkio -lkdecore -lqt-mt
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../x86_64-suse-linux/bin/ld: cannot find -lkio
collect2: ld returned 1 exit status
make[2]: *** [kdialogd3] Error 1
make[2]: Leaving directory `/home/jan/install/kgtk-0.9/kgtk-0.9/kdialogd3'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jan/install/kgtk-0.9/kgtk-0.9'
make: *** [all] Error 2

Report

jakuhr

13 years ago

Same here on a 64bit Gentoo system.

Report

gassauer

13 years ago

same here - IMHO does not look into ../kde35/lib64 in x86_64 systems

After adding this to LDFLAGS I get

/bin/sh ../libtool --silent --tag=CXX --mode=link g++ -fPIC -L/daten/kdesvn/kde35/lib64 -L/usr/local/lib64 -L/usr/lib64 -L/usr/X11R6/lib64 -L/opt/gnome/lib64 -o kdialogd3 kdialogd.o -lkio -lkdecore -lqt-mt
kdialogd.o: In function `KDialogDDirSelectDialog::slotOk()':
kdialogd.cpp:(.text+0x4c6): undefined reference to `KDialogDDirSelectDialog::ok(QStringList const&)'
kdialogd.o: In function `KDialogDDirSelectDialog::~KDialogDDirSelectDialog()':
kdialogd.cpp:(.text+0x5f8): undefined reference to `vtable for KDialogDDirSelectDialog'
kdialogd.cpp:(.text+0x60a): undefined reference to `vtable for KDialogDDirSelectDialog'
kdialogd.o: In function `KDialogDDirSelectDialog::~KDialogDDirSelectDialog()':
kdialogd.cpp:(.text+0x7aa): undefined reference to `vtable for KDialogDDirSelectDialog'
kdialogd.cpp:(.text+0x7bc): undefined reference to `vtable for KDialogDDirSelectDialog'
kdialogd.o: In function `KDialogDDirSelectDialog::~KDialogDDirSelectDialog()':
kdialogd.cpp:(.text+0x95c): undefined reference to `vtable for KDialogDDirSelectDialog'
kdialogd.o:kdialogd.cpp:(.text+0x96e): more undefined references to `vtable for KDialogDDirSelectDialog' follow
kdialogd.o: In function `KDialogDFileDialog::~KDialogDFileDialog()':
kdialogd.cpp:(.text+0x10be): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.cpp:(.text+0x10d0): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.o: In function `KDialogDFileDialog::~KDialogDFileDialog()':
kdialogd.cpp:(.text+0x1286): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.cpp:(.text+0x1298): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.o: In function `KDialogDFileDialog::~KDialogDFileDialog()':
kdialogd.cpp:(.text+0x144e): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.o:kdialogd.cpp:(.text+0x1460): more undefined references to `vtable for KDialogDFileDialog' follow
kdialogd.o: In function `KDialogDFileDialog::slotOk()':
kdialogd.cpp:(.text+0x1cff): undefined reference to `KDialogDFileDialog::ok(QStringList const&)'
kdialogd.o: In function `KDialogDFileDialog::KDialogDFileDialog(QString&, Operation, QString const&, QString const&, bool)':
kdialogd.cpp:(.text+0x1e91): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.cpp:(.text+0x1ea6): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.o: In function `KDialogDFileDialog::KDialogDFileDialog(QString&, Operation, QString const&, QString const&, bool)':
kdialogd.cpp:(.text+0x2217): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.cpp:(.text+0x222c): undefined reference to `vtable for KDialogDFileDialog'
kdialogd.o: In function `KDialogDClient::close()':
kdialogd.cpp:(.text+0x2cd6): undefined reference to `KDialogDClient::error(KDialogDClient*)'
kdialogd.o: In function `KDialogDClient::~KDialogDClient()':
kdialogd.cpp:(.text+0x369e): undefined reference to `vtable for KDialogDClient'
kdialogd.o: In function `KDialogDClient::~KDialogDClient()':
kdialogd.cpp:(.text+0x37d6): undefined reference to `vtable for KDialogDClient'
kdialogd.o: In function `KDialogDClient::~KDialogDClient()':
kdialogd.cpp:(.text+0x390e): undefined reference to `vtable for KDialogDClient'
kdialogd.o: In function `KDialogD::~KDialogD()':
kdialogd.cpp:(.text+0x3a46): undefined reference to `vtable for KDialogD'
kdialogd.o: In function `KDialogD::~KDialogD()':
kdialogd.cpp:(.text+0x3b1c): undefined reference to `vtable for KDialogD'
kdialogd.o: In function `KDialogD::~KDialogD()':
kdialogd.cpp:(.text+0x3bf2): undefined reference to `vtable for KDialogD'
kdialogd.o: In function `KDialogDClient::KDialogDClient(int, QString const&, QObject*)':
kdialogd.cpp:(.text+0x3ce8): undefined reference to `vtable for KDialogDClient'
kdialogd.o: In function `KDialogDClient::KDialogDClient(int, QString const&, QObject*)':
kdialogd.cpp:(.text+0x3f38): undefined reference to `vtable for KDialogDClient'
kdialogd.o: In function `KDialogD::KDialogD(QObject*)':
kdialogd.cpp:(.text+0x4d05): undefined reference to `vtable for KDialogD'
kdialogd.o: In function `KDialogD::KDialogD(QObject*)':
kdialogd.cpp:(.text+0x50f1): undefined reference to `vtable for KDialogD'
collect2: ld returned 1 exit status
make[2]: *** [kdialogd3] Error 1

Report

mutlaqja

13 years ago

Same problem here on OpenSUSE 10.2, I modified LD_LIBRARY_PATH to get over -lkio but I got the 'vtable' errors.

But I fix it by modifying Makefile.am under kdialog3 directory (Line 8)

FROM:

$(QT3_MOC) kdialogd.h > kdialogd.moc

TO:

moc kdialogd.h > kdialogd.moc

Since the moc file was not being generated as $(QT3_MOC) was not really set.

Run 'make distclean', then './configure' then 'make' and it should compile fine.

Report

diffuze

13 years ago

It doesn't work for firefox32, atleast not for me. Any idea why?

It works in normal firefox and it's so pretty that I'm almost crying when I use firefox32.

Report

alanezust

13 years ago

I've been using this for over a year now, and it's great!

However, I just did a recent upgrade to gcc 4.1.3 (debian lenny). Immediately, I started getting segfaults from kgtk, so I thought I'd try rebuilding it.

checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables

from config.log, I get this:
configure:2643: checking for C compiler default output file name
configure:2646: gcc conftest.c >&5
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status


Any idea what is wrong?

Report

alanezust

13 years ago

ignore the last message. for some reason libc6-dev got removed during my last upgrade.

Report

gregbowden2000

13 years ago

This is a great app, makes the desktop nice and unifed. Great work, thanks.

Report

mattepiu

13 years ago

It's not using the localization of the
real KDE file dialogs,
and even worse (probably because the localization bug),
doesn't allow preview mode or to show
hidden files......

Report

mattepiu

13 years ago

Sorry, preview is enabled after restarting KDE,
but dialogs are still only in english
language, while all my
kde isn't....

Report

9 years ago

0.11.0
------
1. Gtk3 support.
2. Better, and safer, lookup of file filters.
3. Correctly determine size of string needed for pidfile!
4. Add thunderbird, and LibreOffice apps, to list of gtk2 apps.
5. Cleanup usless stuff; remove kdialogd3, qt3, qt4, kgtk2-wrapper, kqt3-wrapper, kqt4-wrapper.
6. Merge kgtkXX-wrapper scripts into kgtk-wrapper
7. Install kdialogd4 into KDE4 libexec dir.
8. Fix crash where client is terminated whilst file dialog is open.
9. Configurable debug. Pass cmake -DKGTK_DEBUG=true
When starting app, set KGTK_DEBUG env var, e.g.

KGTK_DEBUG=0x10 kgtk-wrapper lowriter

0x01 Connection debug
0x02 General debug
0x04 Filter get and set debug
0x08 Filter creation debug
0x10 Custom widget debug
0x20 dlsym debug
Values may be combined

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.

12345678910
8
product-maker arcanis Jun 15 2014 9 excellent
product-maker YAFU Sep 26 2012 9 excellent
product-maker frag Sep 20 2012 9 excellent
product-maker dreamsoul Nov 04 2011 9 excellent
product-maker deabru Nov 04 2011 9 excellent
product-maker tcat Jun 20 2011 9 excellent
product-maker unikum111 Apr 25 2011 9 excellent
product-maker ZaWertun Nov 11 2010 9 excellent
Be the first to comment
deabru
Nov 04 2011
tcat
Jun 20 2011
unikum111
Nov 12 2010
tigerfoot
Mar 07 2010
Raboch
Feb 24 2010
DaiVied
Dec 30 2009
Camberwell
Dec 01 2009
usrkl
Oct 07 2009
-luk-
Feb 23 2009
val-gaav
Feb 23 2009
alecs1
Feb 15 2009
File (click to download) Version Description PackagetypeArchitecture Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.11.0
updated Nov 03 2011
added Mar 06 2006
downloads 24h
1
mediaviews 24h 0
pageviews 24h 18