Search:  
Gentoo Wiki

HOWTO_Integrate_Firefox_with_KDE

Image:Klogo-official_100x100.png

K Desktop Environment

Location: HOWTO Integrate Firefox with KDE

KDE Pages

Install

Applications

Upgrading

Tips

Other


edit

Contents

Appearance

Take a look at the screenshots and decide which dialog you want.

Appearance Method 1: kgtk


for a description of kgtk look at: kde-apps.org

Emerge kgtk
Code: Execute in root shell
emerge -av kgtk

To see the kde-file-selector in a gtk-application, just do:

cd /usr/local/bin
ln -s /usr/bin/kgtk-wrapper firefox
/usr/bin/firefox
to
/usr/local/bin/firefox

Attention: this does not seem to work with the binary firefox on 64bit platform

Appearance Method 2: alternate gtk dialog



Appearance Method 3: alternate nsFilePicker.js


(outdated and only for old firefox versions)

The lovely people over at Mozillux have an alternative nsFilePicker.js that use the native KDE file dialogs instead of the GTK ones.

A good idea also, to remove the "GNOME-like" lines on the address bar is to go to the K-menu and select the control center. Search for GTK Styles and Fonts and ensure that "Use my KDE style in GTK applications" is selected as is "Use my KDE fonts in GTK applications". This ensures that firefox, although maintaining its icon theme, will remove almost any visual reference to GNOME that might annoy you.

Firefox as KDE default browser

Open the Control Center, in menu KDE Components -> Component Chooser -> Web Browser, click in the following browser and type in

Themes

Theme


Make GTK+ applications take on the current Qt/KDE theme
Code: Execute in root shell
emerge x11-themes/gtk-engines-qt

PDF: KPDF

Here we use the PDF Download Extension (addons.mozilla.org) for Firefox. This Extension allows you to choose, if you want to download or open a pdf file.

If you have kde installed in a different location, use this command to find kpdf path:

 which kpdf
 -> /usr/kde/3.5/bin/kpdf ''(in example)''

Other File Associations

If you can't change file types properties in your FF, or you want to add new file associations, you can always edit your /etc/mailcap. In order to make kpdf to be your default pdf handler add/change the following line to/in the /etc/mailcap:

application/pdf; kpdf '%s'; test=test "$DISPLAY" != "" ; description="PDF Document" ; nametemplate=%s.pdf

Or for doc, xls, pps files;

application/msword; oowriter '%s'; test=test "$DISPLAY" != "" ; description="Doc file" ; nametemplate=%s.doc
application/vnd.ms-powerpoint; ooimpress '%s'; test=test "$DISPLAY" != "" ; description="Pps file" nametemplate=%s.pps
application/vnd.ms-excel; oocalc '%s'; test=test "$DISPLAY" != "" ; description="XLS file" ; nametemplate=%s.xls

Remember that the mime types at the beginning of mailcap's lines should be present in /usr/share/mime/ directory. For example application/vnd.ms-excel.xml gives application/msexcel as an alias, but stating application/msexcel in mailcap file does not work with firefox.

Even Better: Embed KDE applications in Firefox

Another method which is extremely effective is to use mozplugger ( net-www/mozplugger ). It allows you to configure what applications to use for various mimetypes, and embeds your chosen application into firefox - even inside a webpage that uses <embed> tags. I have it configured to open ODF documents in KOffice, PDFs in KPDF, and video in Kaffeine.

Printing: KPrinter

You have to write about:config in the address bar and change here the print.printer_PostScript/default.print_command to kprinter --stdin.
For KPrinter to work, you have to choose Postscript/default (leaving "Print to file" unchecked) and then click the Print button. At this point you will get the KPrinter dialog and be able to print to pdf, postscript, etc, and of course to the real printers.
It is possible to suppress the print dialog so that it looks like it's printing seamlessly via KPrinter by setting the boolean print.always_print_silent to true in about:config. If this option is missing, simply add it.

print.printer_PostScript/Default.print_command   kprinter --stdin
print.always_print_silent                        true

Sometimes this is not enough. Set

print.postscript.cups.enabled                    false

so it will not print directly to CUPS, but use the PostScript Default Printer which redirects to KPrinter.


Still in about:config, set these values:

print.printer_PostScript/Default.print_paper_height  297,00
print.printer_PostScript/Default.print_paper_name    A4
print.printer_PostScript/Default.print_paper_width   210,00


Using kprinter as print command with Acrobat Reader 7.0: http://printing.kde.org/hacks/acroread7+kprinter.php

Mail client: KMail

Start firefox and type the following in the url bar: about:config. A big table with configuration options will appear in the main browser window. Look for the item network.protocol-handler.external.mailto and make sure its value is set to true. The value is the right most piece of text in the row for that item. Right-click on that line and select "toggle" in the pop-up menu to toggle if necessary.

Now, do a right-click again and select New -> String. A window will appear, asking you to set the name of the new config item, set it to network.protocol-handler.app.mailto and and click OK to confirm. A second window will appear to ask for the value of the config item. Type kmail into its text field and confirm again.

Now, if you click on an email link on a webpage (in the status bar, that is the bar at the lower end of the firefox window, you will see something like mailto:john.doe@johndoe.net) kmail *should* fire up with a new email to that address.

network.protocol-handler.external.mailto  true
network.protocol-handler.app.mailto       kmail

Orginal text at: link


Download manager: KGet

Download FlashGot firefox extensions: download
Once installed and Firefox restarted, go in FlashGot preferences and select KDE KGet as default download manager.


Confirm changes in settings

Type the following in the url bar: about:config and look for the item browser.preferences.instantApply. By changing its value to "false" a "cancel" button will appear in the settings window.

Setting firefox to open extensions using KDE

If you want Firefox to open the same extensions as Konqueror, do the following:

Create a file called kfmClientExecScript with some editor, like nano or vim:

File: kfmClientExecScript
#!/bin/bash
kfmclient exec $1

Then, save it and make chmod +x kfmClientExecScript

You can try it by typing: kfmClientExecScript . at shell and this should open your file manager.

If this is happening, then, sudo and copy this file to /usr/bin

Code: shell
someone@localhost ~ $ su
Password:
localhost someone # pwd
/home/someone
localhost someone # mv /home/someone/kfmClientExecScript /usr/bin -v
`/home/someone/kfmClientExecScript' -> `/usr/bin/kfmClientExecScript'

Now, go to firefox and create the new key network.protocol-handler.app.file, type string and make its value equal to kfmClientExecScript.

network.protocol-handler.app.file = "kfmClientExecScript"

It should be working now.

Links

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Integrate_Firefox_with_KDE"

Last modified: Sat, 06 Sep 2008 07:51:00 +0000 Hits: 64,046