LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-22-2008, 10:34 AM   #1
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Firefox3 and setting a gtk2 icon theme with KDE


I'm testing Firefox 3 out, and so far, so good. I've only got one small niggle.

The default gtk2 icon theme is ugly, so I want to use another one I downloaded (blendedcrystal). I can get it to work easily enough using xfce-setting-show, then changing the theme in the User Interface section. If I start firefox after I've done this, then it uses the chosen icon theme. However, if I don't change the icon theme before starting Firefox, it uses the default icon theme.

I've Googled a bit, and I think that the solution lies in ~/.gtkrc-2.0, but I don't know what to put in there to make it see my new icon theme. I tried what was suggested here http://bbs.archlinux.org/viewtopic.php?pid=369965, but no joy.

Any thoughts are appreciated.
 
Old 05-22-2008, 12:38 PM   #2
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 509

Rep: Reputation: 41
I'm not sure wether or not Firefox 3 actually uses the icon theme supplied by GTK; at least the 2.x generation didn't, because this is handled by XUL.

Anyway, if FF3 does use the GTK icon theming engines, then do this:

In your .gtkrc-2.0 should be something like this:

include "/home/yourhome/.themes/Milk 2.0/gtk-2.0/gtkrc"

This affects with _this_ theme all icons like previous, file new, back, reload and so on - usally the stuff found in menus. This is probably what you need. But not all themes contain every icon you'll want to have.

You may add a line:

include "/home/yourhome/.gtkrc.mine"

And put the include of your theme there. Config tools will leave .gtkrc.mine untouched.

Every icon NOT covered by the theme itself falls back on the default icon set, you'll maybe end up with mixed images.

It seems to be possible to just load a theme specific to an application:

GTK2_RC_FILES=/home/yourhome/.themes/Nice\ Theme/gtk-2.0/gtkrc firefox

Something like this.

(And your loading mechanism might have something to do with the fact that FF uses gconfd to get ressources concerning the GUI, so I'll assume that the xfce-settings-manager maybe simply talks to the gconfd... but I'm not really sure.)

Last edited by Su-Shee; 05-22-2008 at 12:40 PM.
 
Old 05-22-2008, 02:44 PM   #3
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Original Poster
Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by Su-Shee View Post
I'm not sure wether or not Firefox 3 actually uses the icon theme supplied by GTK; at least the 2.x generation didn't, because this is handled by XUL.
Integration with the operating system's environment like this is one of the new features of Firefox 3. For example, in OS X, the toolbar separates from the rest of the Firefox window, just like any other OS X app. So for Linux, the interface takes on the GTK themes.
Quote:
Originally Posted by Su-Shee View Post
Anyway, if FF3 does use the GTK icon theming engines, then do this:

In your .gtkrc-2.0 should be something like this:

include "/home/yourhome/.themes/Milk 2.0/gtk-2.0/gtkrc"

This affects with _this_ theme all icons like previous, file new, back, reload and so on - usally the stuff found in menus. This is probably what you need. But not all themes contain every icon you'll want to have.
The trouble is this is just an icon set, not an entire theme.
Quote:
Originally Posted by Su-Shee View Post
It seems to be possible to just load a theme specific to an application:

GTK2_RC_FILES=/home/yourhome/.themes/Nice\ Theme/gtk-2.0/gtkrc firefox

Something like this.
Unfortunately, there is no gtkrc file associated with this theme - it's just a series of directories for different sized icons. I've placed these files in a folder in /usr/share/icons/ with all my other icon themes, and they get picked up OK by XFCE (and KDE), but I just can't get the icon set to load at startup.
Quote:
Originally Posted by Su-Shee View Post
(And your loading mechanism might have something to do with the fact that FF uses gconfd to get ressources concerning the GUI, so I'll assume that the xfce-settings-manager maybe simply talks to the gconfd... but I'm not really sure.)
I don't have gnome (and therefore gconfd installed on this machine - so I'm not sure how XFCE is managing to load the theme - I'll see if I can figure out which process gets loaded and try to do it manually.

Any other thoughts are welcome
 
Old 05-23-2008, 03:46 AM   #4
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 509

Rep: Reputation: 41
If it is just a set of images, you'll probably have to create a fitting gtk-setting by yourself. You may get away with just setting the buttons needed - see here for the proper names and put something like this into your gtkrc.mine:

Code:
stock["gtk-goto-first"] =     {{ "stock_goto-first.svg" }}
stock["gtk-goto-last"] =      {{ "stock_goto-last.svg" }}
stock["gtk-goto-top"] =       {{ "stock_goto-top.svg" }}
stock["gtk-go-back"] =        {{ "stock_go-back.svg" }}
Check "real" gtk themes for their iconrc-file, usally it resides in the gtk-2.0/icons subdirectory of the theme.

And sadly, several gtk-based applications use gconfd, even if you don't use Gnome.

I don't know wether or not this is the case with FF3, I didn't switch yet. (I should probably do now and try it. )
 
Old 05-23-2008, 04:09 AM   #5
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Original Poster
Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by Su-Shee View Post
If it is just a set of images, you'll probably have to create a fitting gtk-setting by yourself. You may get away with just setting the buttons needed - see here for the proper names and put something like this into your gtkrc.mine:

Code:
stock["gtk-goto-first"] =     {{ "stock_goto-first.svg" }}
stock["gtk-goto-last"] =      {{ "stock_goto-last.svg" }}
stock["gtk-goto-top"] =       {{ "stock_goto-top.svg" }}
stock["gtk-go-back"] =        {{ "stock_go-back.svg" }}
Check "real" gtk themes for their iconrc-file, usally it resides in the gtk-2.0/icons subdirectory of the theme.
Thanks, I'll try this today.
Quote:
Originally Posted by Su-Shee View Post
And sadly, several gtk-based applications use gconfd, even if you don't use Gnome.
I'm pretty certain I don't have gconfd since Slackware doesn't ship with gnome. I also I locate'd it, and nothing came up. Anyway, evidently something's getting started, but I'm not sure what.
Quote:
Originally Posted by Su-Shee View Post
I don't know wether or not this is the case with FF3, I didn't switch yet. (I should probably do now and try it. )
I like the new Firefox so far - and it's not crashed for me yet (touch wood). From a day to day browsing experience point of view, it's not changed much, but it feels more responsive, and its memory footprint is lower.
 
Old 05-23-2008, 11:09 AM   #6
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 509

Rep: Reputation: 41
Ok, I took your question as an occasion-not-to-be-ignored to install FF3 - the GTK theme obedience is slightly annoying, depending on the theme.

Most (I have/like/want) simply lack a handful of icons necessary for FF.

I'll have the weekend to try some things out and let you know. I want nice icons, too.

(And why does my font suddenly look suspiciously like the wrong hintstyle - but only in FF?)
 
Old 06-02-2008, 02:40 AM   #7
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Original Poster
Rep: Reputation: 128Reputation: 128
In the end, I didn't make a new gtkrc file, but read in another thread here that simply adding a symlink to /usr/bin/xfce-mcs-manager in ~/.kde/autostart loads the gtk theme selected in xfce-setting-show.
 
Old 06-04-2008, 07:21 AM   #8
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 509

Rep: Reputation: 41
I'll add the answer anyway, because with FF3 coming, you'll be probably not the only one with this question.

This is how I did it:

1) Firefox 3 obeys Gtk themes.

2) Firefox uses most of the standard icons (like "Cancel"), but adds a few more which are probably not found in most existing Gtk themes

3) To get a list of ALL icons needed by Firefox, do this:

* copy from Firefox' chrome directory "browser.jar" somewhere save in your home, unzip it and do a simple

Code:
grep "stock" /skin/classic/browser/browser.css > list-of-icons-needed.txt
The file looks like this:

Quote:
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu");
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu&state=disabled");
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu");
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu&state=disabled");
list-style-image: url("moz-icon://stock/gtk-home?size=menu");
.
.
.
and loads all the pre-defined Gtk stock icon settings from the Gtk theme in use into Firefox via CSS.

Everything _after_ "//stock/" is a gtk stock icon identifier which serves as your mapping gtk-icon-name to icon-image.

As you can see, specifically the back and forward buttons exists in 4 states each: enabled, disabled and for from-left-to-right written languages and right-to-left languages (arabic for example). FF3 seems not to load "gtk-go-back" and "gtk-go-forward", so I've added a "gtk-go-back-ltr" and "gtk-go-back-rtl" (same for gtk-go-forward).

You'll take this identifier and your icon image file and add this to your .gtkrc.mine in your home directory:

First include a line like this:

Code:
include "/home/yourHome/yourThemes/yourFFicons/iconrc"
In "yourFFicons", you'll throw all the images used for the icons and you add an "iconrc" file in the same dir, which contains essentially only the long list of mapping icon to image:

Code:
style "icon-style" {
  stock["gtk-close"] = {{"gtk-close.png", *, *, * }}
  stock["gtk-cancel"] = {{"gtk-cancel.png", *, *, * }}
  stock["gtk-go-back"] = {{ "gtk-go-back.png", *, *, * }} # seems unused by FF3, but by other Gtk apps
  stock["gtk-go-back-ltr"] = {{ "gtk-go-back.png", *, *, * }}
  stock["gtk-go-forward"] = {{ "gtk-go-forward.png", *, *, * }} # seems unused by FF3, but by other Gtk apps
  stock["gtk-go-forward-ltr"] = {{ "gtk-go-forward.png", *, *, * }}
}

class "GtkWidget" style "icon-style"
Et viola - restart FF, and there you go.

This looks like this:

new close tab icon

new back and forward icon

Caveat: Re-defining certain stock icons will override stock icons already defined from within the Gtk theme in use and not just the Firefox stuff. Add either only the icons missing in Firefox to your regular Gtk theme OR load a theme for Firefox only - see below. I personally don't like my favorite Gtk theme in Firefox, it's just not optimized for the browser, so I'll stick with something Firefox-specific...

If you're going to setup an entire theme for Firefox (styling the tabs, scrollbar, the overall color etc.), I would set up a "real" Gtk theme like this:

* make a directory "Firefox" in .themes, add a "gtk-2.0" subdir
* add a gtkrc in gtk-2.0 and put all the firefox stuff in there
* add an "icons" subdir in gtk-2.0, put add an iconrc file like above
* add a "include icons/iconrc" in gtkrc

Load the theme for Firefox specifically:

Code:
GTK2_RC_FILES=.themes/Firefox/gtk-2.0/gtkrc firefox
Consult already existing Gtk themes for inspiration and as an example setup and check http://library.gnome.org/devel/gtk/s...rce-Files.html for more information on Gtk themes.

A list with stock icons (with example image) can be found here:

http://library.gnome.org/devel/gtk/u...ock-Items.html

Last edited by Su-Shee; 06-04-2008 at 07:23 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE - icon theme path mathfeel Linux - General 2 08-16-2007 07:16 PM
Choosing a GTK1/GTK2 theme for KDE in Slackware tubatodd Slackware 4 06-24-2006 10:21 PM
setting a default icon theme (gnome+fluxbox) hungrigerhaifisch Linux - Software 7 09-12-2005 05:39 PM
Icon theme for kde revenge80200 Linux - Newbie 8 11-30-2004 12:51 PM
KDE icon theme help syphon00 Linux - General 1 08-24-2002 12:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration