Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There are several related questions, but I found none that really answered this detail:

Where is the reference to the current icon theme stored?

Since the icon theme can be changed, hence so too the path to its folder, it must be stored somewhere. I'm making an application and I want it to draw its own icons from the icon theme currently in use. I've seen answers showing how to retrieve the path using Python and Gtk, but I am using PyQt and would like to avoid importing Gtk as well.

Is there a configuration file somewhere holding the current icon theme's name or path? Or do you know a PyQt means to do that?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

A reference to the current icon theme can be found in gconf-editor at:

desktop > gnome > interface > icon_theme

enter image description here

You can alternatively read directly ~/.gconf/desktop/gnome/interface$ cat %gconf.xml file.

Unfortunately, this does not provide a path to the relevant icon theme. I'll check how this setting relates to the path and i'll let you know ;-)

share|improve this answer
1  
Yes it's interesting. Especially in your case---Faenza Darkest---which in and of itself is incomplete and takes most of its icons from the main Faenza theme. –  Benjamin Aug 21 '11 at 22:32
    
My case is not the best example, cause i've installed gnome3 and my system is currently mixed with gconf and dconf settings...but anyways.. –  Pavlos G. Aug 22 '11 at 10:19
add comment

Have a look at PyXDG (package python-xdg in Ubuntu). xdg.IconTheme.getIconPath(iconname) gets you the path to the give icon.

share|improve this answer
    
This doesn't give me the icon of the current theme. If I take the result of IconTheme.getIconPath('anki'), it returns /usr/share/pixmaps/anki.xpm which is incorrect since the current theme is 'Faenza' and the corresponding file for Anki is at ~/.icons/Faenza/Apps/. The Anki desktop file does not specify this pixmaps path either. –  Benjamin Aug 21 '11 at 22:42
add comment

This looks too easy, so I'm probably missing something here... but what about:

icon = QIcon.fromTheme("firefox")

QT is supposed to take care of this itself.

share|improve this answer
    
Thanks. Indeed, According to the doc, it should work :) I'll try that. –  Benjamin Aug 22 '11 at 7:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.