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
Score 76.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:

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

Decepticon

12 years ago

Man, this hack is awesome. Finally I ridded myself from that annoying opera file dialogs...

Report

ezust

12 years ago

trying to build from source on debian lenny with kde 3.5

$ cmake .. -DKGTK_KDE3=true -DCMAKE_INSTALL_PREFIX=/usr/local
$ make

[ 18%] Building CXX object kdialogd3/CMakeFiles/kdialogd3.dir/kdialogd.o
In file included from /usr/local/KGtk-0.9.4/kdialogd3/kdialogd.cpp:712:
/usr/local/KGtk-0.9.4/build/kdialogd3/kdialogd.moc:12:2: error: #error "The header file 'kdialogd.h' doesn't include <QObject>."
In file included from /usr/local/KGtk-0.9.4/kdialogd3/kdialogd.cpp:712:
/usr/local/KGtk-0.9.4/build/kdialogd3/kdialogd.moc:44: error: ‘const QMetaObject KDialogDFileDialog::staticMetaObject’ is not a static member of ‘class KDialogDFileDialog’


It seems to be using KDE4 version of kdialogd.h even though I specified KDE3. Am I doing something wrong?


Report

ov1d1u

12 years ago

Hi!

I have downloaded the pre-build .deb package, and when I try to run an application with kgtk-wrapper or kgtk2-wrapper, it returns me an error:

/usr/bin/kgtk2-wrapper: line 29: 7462 Segmentation fault (core dumped) LD_PRELOAD=/usr/lib/kgtk/libkgtk2.so:$LD_PRELOAD "$@"

How to solve that? :(

(I have Kiwi Linux 8.03 (ubuntu-based) with kubuntu-desktop installed with KDE 3.5.8)

Report

ov1d1u

12 years ago

Hi!

I have downloaded the pre-build .deb package, and when I try to run an application with kgtk-wrapper or kgtk2-wrapper, it returns me an error:

/usr/bin/kgtk2-wrapper: line 29: 7462 Segmentation fault (core dumped) LD_PRELOAD=/usr/lib/kgtk/libkgtk2.so:$LD_PRELOAD "$@"

How to solve that? :(

Report

identity0

12 years ago

I get this error at "cmake .. -DCMAKE_INSTALL_PREFIX=/usr"

-- Didn't find KDE3 headers
-- Didn't find KDE3 core library
-- Didn't find the KDE3 dcopidl preprocessor
-- Didn't find the KDE3 dcopidl2cpp preprocessor
-- Found KDE3 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
** ERROR : Could not locate Qt3/KDE3 headers, KDialogD for KDE3 will not be built.
** ERROR : Could not locate Gtk2 headers, Gtk2 LD_PRELOAD library will not be built.
** ERROR : Could not locate Qt3 headers, Qt3 LD_PRELOAD library will not be built.
** INFORMATION: Using installation prefix: /usr
-- Configuring done

How do I tell it where Gtk2 headers are, and where are they?

Report

Murz

11 years ago

Did you try to install libgtk2.0-dev package? command:
sudo aptitude install libgtk2.0-dev

It works for me on Kubuntu Hardy KDE4.1

Report

bamm

12 years ago

cmake complains a lot. Where can I just get an rpm version? I'm using Mandriva 2008, KDE 3.5.9, Firefox 2.0.0.13. Thanks!

Report

joth666

12 years ago

I'm trying to compile this for KDE4 (4.0.2.) and I've hit a roadblock.

cmake doesn't complain about anything (using cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DKGTK_KDE4=true -DKGTK_QT4=true -DKGTK_GTK2=false -DLIB_PREFIX=64 as per the readme file).

Make complains though...

What does the following mean and what can be done to fix it?

[ 9%] Building CXX object kdialogd4/CMakeFiles/kdialogd4_bin.dir/kdialogd.o
/home/jj/download/KGtk-0.9.4/kdialogd4/kdialogd.cpp: In constructor ‘KDialogD::KDialogD(QObject*)’:
/home/jj/download/KGtk-0.9.4/kdialogd4/kdialogd.cpp:171: error: ‘OnlyLocal’ is not a member of ‘KConfig’
/home/jj/download/KGtk-0.9.4/kdialogd4/kdialogd.cpp: In member function ‘void KDialogDClient::finished()’:
/home/jj/download/KGtk-0.9.4/kdialogd4/kdialogd.cpp:385: error: cast from ‘KDialog*’ to ‘int’ loses precision
/home/jj/download/KGtk-0.9.4/kdialogd4/kdialogd.cpp: At global scope:
/home/jj/download/KGtk-0.9.4/kdialogd4/kdialogd.cpp:670: warning: unused parameter ‘modal’
make[2]: *** [kdialogd4/CMakeFiles/kdialogd4_bin.dir/kdialogd.o] Error 1
make[1]: *** [kdialogd4/CMakeFiles/kdialogd4_bin.dir/all] Error 2
make: *** [all] Error 2

Report

ingomueller-net

12 years ago

I'm using Thunderbird with the KGtk-Wrapper since a couple of weeks and it works just fine! Maybe you want to add TB to the list of supported applications... Anyway, thanks a lot for your work!

Report

philes

11 years ago

helo,

Could I ask you how you proceed , because in my case it doesn't work.
I have kubu 8.04 , thunderbird 2.0.0.17; just for information it works fine with Firefox 3 but the reason I have instaled KGTK 0.10 is to use it with Thunderbird!!! ( to see miniatures of pictures that I want to send)
Thanks a lot for your help!!!


philes

Report

fdservices

12 years ago

This is an absolutely must have utility. Thank you so much. I have been looking to replace thunderbird because of the absolutely impossible file picker/chooser. Now I can carry on using it. Well done!

Report

Viruscg

12 years ago

KGtk 0.9.4 Gutsy + Portuguese translation

http://www.adrive.com/public/4ee9cb7fed51fc916bdfc8b086053bb991a61ef2e69121e1c9d697fc10b5a65a.html

Report

Moony

12 years ago

I really like th concept of this program, but 2 major issues:

1. When I run /usr/bin/kgtk-wrapper /usr/bin/firefox, it tries to preload /usr/lib/kgtk/libgtk2.so. I'm running 64 bit though, so I get the "cannot preload, ignoring" message. If I manually change the path to lib64 in kgtk2-wrapper, then it works. Can't this be auto-detected somehow?

2. In Opera, If I cancel out of the KDE Dialog, my system goes into a tailspin, the hard drive goes nuts, the mouse gets choppy, and I have to manually reset my system!!!

I'm scared to go on. What can be done to fix these problems? Thanks.

Report

C

CraigD

12 years ago

Sorry, I don't have access to a 64-bit system - so I'm not sure how to go about doing this.

As for opera, works fine for me under 32-bit KUbuntu Gutsy. All I can suggest, is editing the source files and adding lots of debug to see whats going on.

Report

arendjr2

12 years ago

Somehow Firefox 2 on KUbuntu Feisty Fawn still uses GTK2 dialogs, even though I have added firefox=gtk2 in kgtkrc. Eclipse does work however.

Report

LDK

12 years ago

i ve made the amd64 package with checkinstall (debian lenny)

http://w15.easy-share.com/1699674576.html

Report

fatbuttlarry

12 years ago

warning if you start avant-window-navigator with this, it will launch all other applications with it.

most importantly, pidgin won't launch from the awn-dock anymore.

-Tres

Report

fatbuttlarry

12 years ago

avant-window-navigator works for the most part.

pidgin does not.

-Tres

Report

croscato

12 years ago

When used with Compiz Fusin 0.6 the KGtk apresent a little window on the top left size of the screen.

This window when resizing has the same name of the open application.


It's very annoying. Anyone has the same problem? Could you solve it?

Thanks in advance.

Report

Baldrun

12 years ago

Kgtk works fine for:
- dia

Doesn't work for:
- hugin

Report

Baldrun

12 years ago

Kgtk "seems" to work fine in combination with the following apps using kde 3.5.7 on my gentoo machine:
- firefox
- gtk-lshw
- kino
- opera
- qtpfsgui
- streamtuner
- gimp
- inkscape
- mixxx
- pdfedit
- scribus
- lyx

It didn't work properly for me in combination with:
- audacity
- vym
- gtk-recordMyDesktop
- xine
- audacious
- gnumeric
- cinepaint

Report

cookies

12 years ago

Work for me. Using Kubuntu Gutsy 7.10 with Opera's own shared qt .deb package.

Report

inane

12 years ago

Just a heads up - I tested this with the alpha8 version of Gran Paradiso (Firefox 3) and so far it does not seem to work at all, no error message. It works fine, of course with Firefox 2.0 and Gimp on my machine but does nothing for dialogs, as of yet in Firefox 3. Thanks for all the hard work!

Report

C

CraigD

12 years ago

...it does in fact work, just an error in one of the scripts.

kgtk2-wrapper ./firefox

...will work

kgtk-wrapper is a further script that tries to determine the toolkit being used in the application - so as to know whether its a Qt3, Qt4, or Gtk2 application. This kgtk-wrapper is failing to detect that firefox is a Gtk2 app - hence calling kgtk-wrapper directly works. To fix kgtk-wrapper, change:

if [ "$app" = "kgtk-wrapper" ] ; then
app=$1
useApp=0
fi

to:

if [ "$app" = "kgtk-wrapper" ] ; then
app=`basename $1`
useApp=0
fi

Report

inane

12 years ago

You sir are THE MAN!!! I love you so hard! LOL You made my day!! Worked like a charm.

Am I the only one who is sick of the GTK dialogs not showing previews? Don't get me wrong, I love GNOME and have used it for years but I'm just at home with KDE and I'm happily awaiting KDE4. . . ugh Firefox 3 (using native icons and widgets) on top of plasma, that is hot, am I right?

Report

8 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
product-maker Base: 4 x 5.0 Ratings
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
0
mediaviews 24h 0
pageviews 24h 13