Icon themes and Qt

863 views
Skip to first unread message

Jerome Leclanche

unread,
May 8, 2012, 4:24:57 PM5/8/12
to razo...@googlegroups.com
Alright, I'd like to go in details about the changes needed in Qt in order to support fd.o cross-desktop icon themes.

The current situation:
Qt's ::fromTheme has some heuristics which only work in KDE, really. It's somewhat broken in gnome/lxde and falls back to hicolor everywhere else. Only solution around it is to call ::setThemeName, which is not practical.

After writing my theme-config spec, I talked to the GTK guys and they gave very clear explanations why it was the wrong approach:
 - Storing settings should be up to the DE as much as possible. Doing otherwise would conflict with the advantages of settings daemons (gsettings etc). As much as I hate those daemons, I believe they are correct, the last thing we want to do is force the storage of settings.
 - "Live" setting storage (current icon theme) is done with xsettings. Xsettings is an established spec. GTK supports it, KDE has a plugin for it.

This is the reference file that stores the gtk xsettings keys/names. Relevant for us is Net/IconThemeName. Net/SoundThemeName should also be on the radar if Qt ever decides to implement proper sound theme support. CursorTheme{Name,Size} is in the Gtk namespace for some reason, that's an issue with the gtk guys.
I don't know what KeyThemeName is, nor ThemeName.

I brought the subject up a few weeks ago in #qt-labs and the consensus was basically "If there's a spec the gtk guys can agree with, we'll go with it".  The problem: I don't believe Qt does any interaction with Xsettings. As such, that would have to be implemented, before a working ::fromTheme implementation can be written.

As for the Razor side: We can always create a "soft" reimplementation that uses xsettings and setThemeName in Razor apps to set the theme to the current detected one -- that would basically be a hack for Qt 4.x.

If someone wants to step up to work on this (especially in the Qt side), please give a sign as I do not know how much time left there would be for this to be accepted into Qt 5.0.

N.A.Y.

unread,
May 8, 2012, 4:37:56 PM5/8/12
to razo...@googlegroups.com


среда, 9 мая 2012 г., 3:24:57 UTC+7 пользователь Jerome Leclanche написал:
Qt's ::fromTheme has some heuristics which only work in KDE, really.
Qt supports Gnome too: look in source.

PICCORO McKAY Lenz

unread,
May 8, 2012, 4:40:05 PM5/8/12
to razo...@googlegroups.com
hey NAY, the support of gnome is realy a build in plugin-style since qt4 4.5.1, and Jerome talk about implement handle of icon theme sopport directly from qt itseft with any stlyle applied

--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en



--
Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
Cofundador de Venenux;  debian based multimedia alike free only zealots users (oh well, i try but..too many free guidelines buahhh)
http://shutendouji.net
creador de massenkoh linux; debian enhanchements for better up to date support on stable brand, including non-free soft.

Jerome Leclanche

unread,
May 8, 2012, 4:43:06 PM5/8/12
to razo...@googlegroups.com
<girishr_> Adys: sounds acceptable to me. we only don't allow api changes at this point
<girishr_> Adys: any fixes to make desktop integration better are welcome
<Adys> girishr_: it would be an internal change, but depending on how big xsettings support would have to be, it'd be a large changeset
<girishr_> Adys: i don't think we had xsettings in qt, so i think the post is correct that Qt needs to have an implementation of that first
<girishr_> Adys: it affects only xcb plugin, so shouldn't be a problem
<girishr_> Adys: sroedal is the xcb maintainer afaik
<girishr_> capisce: ^

N.A.Y.

unread,
May 8, 2012, 4:50:54 PM5/8/12
to razo...@googlegroups.com

PICCORO McKAY Lenz

unread,
May 8, 2012, 5:13:36 PM5/8/12
to razo...@googlegroups.com
#ifndef QT_NO_STYLE_GTK

as i said, need gtk style an implement icon from gtk style, if not use kde style, this is a wrapper, and not a qt4 real icons implementarion

the code cited in link url u said, detect only gnome/gtk style and kde .. not qt4 or independent icon set..

but its a good wrapper.. for now.. 

On Tue, May 8, 2012 at 4:20 PM, N.A.Y. <nayr...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en

Petr Vanek

unread,
May 9, 2012, 2:38:53 AM5/9/12
to razo...@googlegroups.com
good news. Will you continue with this communication, please?

Jerome Leclanche

unread,
May 9, 2012, 4:33:14 AM5/9/12
to razo...@googlegroups.com
Yeah, but there isn't much else to say unless someone steps up -- maybe the Andromeda dev might want to work on it, it's worth asking.

J. Leclanche

Alec Moskvin

unread,
May 9, 2012, 11:52:35 AM5/9/12
to razo...@googlegroups.com
On Tuesday 08 May 2012 13:24:57, Jerome Leclanche wrote:
<snip>
> - "Live" setting storage (current icon theme) is done with xsettings.
> Xsettings is an established spec. GTK supports it, KDE has a plugin for it.
>
> http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdksettings.c
> This is the reference file that stores the gtk xsettings keys/names.
> Relevant for us is Net/IconThemeName. Net/SoundThemeName should also be on
> the radar if Qt ever decides to implement proper sound theme support.
> CursorTheme{Name,Size} is in the Gtk namespace for some reason, that's an
> issue with the gtk guys.
> I don't know what KeyThemeName is, nor ThemeName.
>
> I brought the subject up a few weeks ago in #qt-labs and the consensus was
> basically "If there's a spec the gtk guys can agree with, we'll go with
> it". The problem: I don't believe Qt does any interaction with Xsettings.
> As such, that would have to be implemented, before a working ::fromTheme
> implementation can be written.
>
> As for the Razor side: We can always create a "soft" reimplementation that
> uses xsettings and setThemeName in Razor apps to set the theme to the
> current detected one -- that would basically be a hack for Qt 4.x.
>
> If someone wants to step up to work on this (especially in the Qt side),
> please give a sign as I do not know how much time left there would be for
> this to be accepted into Qt 5.0.
>

Do you know what the plan is for when Wayland comes out?

XSETTINGS obviously can't be used there...

Jerome Leclanche

unread,
May 9, 2012, 11:58:07 AM5/9/12
to razo...@googlegroups.com
--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en

No, I will look into it.

J. Leclanche


PICCORO McKAY Lenz

unread,
May 9, 2012, 12:19:53 PM5/9/12
to razo...@googlegroups.com
err i'm joking but what about a razorqt icon theme just ported from oxygen whenantime? jajajajaj

Jerome Leclanche

unread,
May 9, 2012, 12:35:10 PM5/9/12
to razo...@googlegroups.com
We're going to need to port oxygen eventually to be honest, I believe I mentioned that in an earlier post. Its dependencies on KDE are annoying.

J. Leclanche

PICCORO McKAY Lenz

unread,
May 9, 2012, 1:40:21 PM5/9/12
to razo...@googlegroups.com
jeje, was a joke, but comes to become a future plans feature.. O.o!

Jerome Leclanche

unread,
May 11, 2012, 6:50:41 PM5/11/12
to razo...@googlegroups.com
Is there anyone who's willing to work on this? Apparently Qt had an xsettings backend at some point so it should be easy to get that code up and running again. But if we want this in 5.x we have to hurry.

Petr Vanek

unread,
May 12, 2012, 1:43:12 AM5/12/12
to razo...@googlegroups.com
On May 12, 2012 (Saturday), at 12:50 AM, Jerome Leclanche wrote:

Is there anyone who's willing to work on this? Apparently Qt had an xsettings backend at some point so it should be easy to get that code up and running again. But if we want this in 5.x we have to hurry.

I can help. But I'm really lost in "what is xsetting and how whould we use in razor" question. I mean - let's split roles: you can be an architect and I'll code it. ;) 

Александр Соколов

unread,
May 12, 2012, 5:32:11 AM5/12/12
to razo...@googlegroups.com
Icons is my cross, so I can do it. You wrote "Qt had an xsettings backend at some point" - where is?
The problem is xsettins used X messages, but this require to create the X11 window. I don't know how to create window in the static method, that in theory may be used in the console applications.  Any idea?

In addition we should to write xsettings daemon. Based on xsettings reference implementation  (BSD like license) or xsettings-kde (but this under GPL2 only license)


2012/5/12 Jerome Leclanche <ady...@gmail.com>
Is there anyone who's willing to work on this? Apparently Qt had an xsettings backend at some point so it should be easy to get that code up and running again. But if we want this in 5.x we have to hurry.

--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en



--
Best regards,
Alexander.

Jerome Leclanche

unread,
May 12, 2012, 7:06:04 AM5/12/12
to razo...@googlegroups.com
On Sat, May 12, 2012 at 10:32 AM, Александр Соколов <sokol...@gmail.com> wrote:
Icons is my cross, so I can do it. You wrote "Qt had an xsettings backend at some point" - where is?

In the reply I got, this is what the dev said:
"""
Qt used to read other things from the XSettings. In the function 
qt_set_x11_resources Qt 4's qapplication_x11.h, we read the color scheme.
I think with the move to QPA, this code has been lost. (notice that the color
scheme read there is less complete than the color scheme read by the config
file)
""""

 
The problem is xsettins used X messages, but this require to create the X11 window. I don't know how to create window in the static method, that in theory may be used in the console applications.  Any idea?

Hm, that would be a question better suited for the other Qt devs, I think. 
 
In addition we should to write xsettings daemon. Based on xsettings reference implementation  (BSD like license) or xsettings-kde (but this under GPL2 only license)

Yes, we'll need to write a simple icon theme setter for razor, and that'll need an xsettings daemon.

I was thinking maybe we can just have it in libqtxdg, seeing as it's a freedesktop spec?

Alec Moskvin

unread,
May 12, 2012, 11:47:00 AM5/12/12
to razo...@googlegroups.com
On Saturday 12 May 2012 13:32:11, Александр Соколов wrote:
> Icons is my cross, so I can do it. You wrote "Qt had an xsettings
> backend at some point" - where is?
> The problem is xsettins used X messages, but this require to create
> the X11 window. I don't know how to create window in the static
> method, that in theory may be used in the console applications. Any
> idea?

If I understand it correctly, only the Manager needs to have a window.
The clients just need to be able to open an X connection. All of those
seem to be done in the xsettings-*.c files.

The biggest problem in order to get it into Qt5 is that all the Xlib
code would need to be rewritten with XCB, which is very poorly
documented, and in some cases does not have a 1:1 match to the Xlib API.

> In addition we should to write xsettings daemon. Based on xsettings
> reference implementation<http://www.freedesktop.org/software/xsettings/releases/xsettings-0.2.tar.gz>
> (BSD like license) or
> xsettings-kde <http://svn.mandriva.com/svn/soft/theme/xsettings-kde/trunk/>
> (but this under GPL2 only license)

The only GPL2 part is the one that reads kderc, which we don't need. The
rest is just copied from the reference implementation. GNOME does the
same:
http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/xsettings/

Jerome Leclanche

unread,
May 19, 2012, 12:38:42 PM5/19/12
to razo...@googlegroups.com
Hi Alex,

What is the status on this? Any chance you can pop on irc?

Александр Соколов

unread,
May 20, 2012, 5:17:06 AM5/20/12
to razo...@googlegroups.com
Sorry, but I don't had enought time for it. I looked on kde sources, but I'm not starting coding yet.

2012/5/19 Jerome Leclanche <ady...@gmail.com>



--
Best regards,
Alexander.

PICCORO McKAY Lenz

unread,
May 21, 2012, 9:26:11 AM5/21/12
to razo...@googlegroups.com
Due status of this, next razorqt release 0.5.X must be have a note for dependency of oxigen icon theme.. or make a icon theme based on oxygen.. this its a rapid hack of solution temporaly wheantime this will solved!

Александр Соколов

unread,
May 21, 2012, 10:10:35 AM5/21/12
to razo...@googlegroups.com
This is 2 different bugs. 
You talk about situation: User uses non oxygen icon theme and razor can't show icon.

This bug is: User run pure Qt application (maybe not in Razor), and this application has no way of knowing name of the current icons theme.

2012/5/21 PICCORO McKAY Lenz <mckayg...@gmail.com>



--
Best regards,
Alexander.

PICCORO McKAY Lenz

unread,
May 21, 2012, 2:15:23 PM5/21/12
to razo...@googlegroups.com
This bug is: User run pure Qt application (maybe not in Razor), and this application has no way of knowing name of the current icons theme.
of course .. first situation relies on second.. its consecuence

Jerome Leclanche

unread,
May 21, 2012, 2:28:09 PM5/21/12
to razo...@googlegroups.com
See my reply before. If we want a workaround, we simply need to recreate the icon theme detection method in razor.

J. Leclanche

N.A.Y.

unread,
May 21, 2012, 4:04:04 PM5/21/12
to razo...@googlegroups.com
Simply icon theme detection: 
#ifdef Q_WS_X11
	QString de = getenv("DESKTOP_SESSION");
    if(de.contains("razor", Qt::CaseInsensitive)) {
		QSettings gset("razor", "razor");
		QIcon::setThemeName(gset.value("icon_theme", QIcon::themeName()).toString());
	}
#endif
 
But we have to patch Qt to support the universal Qt-theme like ~/.qtrc of ~/.config/qtrc .
Reply all
Reply to author
Forward
0 new messages