Version: (using KDE KDE 3.3.91) Installed from: Compiled From Sources Compiler: gcc 3.4.3 OS: Linux if you don't install kde to /usr and you set the XDG_DATA_DIRS variable to /usr kde doesn't recognize the icons folder and so some apps don't show the icon that is defined in the .desktop files here is my XDG setup: XDG_DATA_DIRS="/usr/share:/usr/share:/opt/gnome/share:/opt/kde/share" temporary workaround for that problem is to define an additional KDEDIR like that: KDEDIR="/opt/kde" KDEDIRS="/opt/kde:/usr"
Created attachment 12524 [details] Adds icon lookup in XDG_DATA_DIRS This patch looks a bit hacky, but kdecore seems to be hacky anyways (when I started doing it the "right" way, I got so many compiler warnings that I had to C&P the compiler output in a text editor to find the error in it). What this patch actually does is looking up icons in $KDEDIRS/icons and $KDEDIRS/pixmaps as usual, and besides those standard dirs, it also looks at $XDG_DATA_DIRS/icons and $XDG_DATA_DIRS/pixmaps. According to the icon theme specifications at http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html, looking in XDG_DATA_DIRS/icons and /usr/share/pixmaps is standard, but too many applications store pixmaps in their own prefix, resulting in things like /opt/gnome/share/pixmaps. GTK+ also looks for icons in XDG_DATA_DIRS/pixmaps, so I do the same with KDE now.
Patch looks good.
SVN commit 576641 by lunakl: Read icons also from $XDG_DATA_DIRS, modified patch from #97776. FEATURE: 97776 M +2 -0 kiconloader.cpp M +2 -2 kicontheme.cpp M +3 -0 kstandarddirs.cpp --- branches/KDE/3.5/kdelibs/kdecore/kiconloader.cpp #576640:576641 @@ -260,6 +260,8 @@ QStringList dirs; dirs += d->mpDirs->resourceDirs("icon"); dirs += d->mpDirs->resourceDirs("pixmap"); + dirs += d->mpDirs->resourceDirs("xdgdata-icon"); + dirs += "/usr/share/pixmaps"; for (QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) d->mpDirs->addResourceDir("appicon", *it); --- branches/KDE/3.5/kdelibs/kdecore/kicontheme.cpp #576640:576641 @@ -105,7 +105,7 @@ } // Find the theme description file. These are always global. - icnlibs = KGlobal::dirs()->resourceDirs("icon"); + icnlibs = KGlobal::dirs()->resourceDirs("icon") + KGlobal::dirs()->resourceDirs("xdgdata-icon"); for (it=icnlibs.begin(); it!=icnlibs.end(); ++it) { cDir = *it + name + "/"; @@ -466,7 +466,7 @@ return *_theme_list; _theme_list = new QStringList(); - QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon"); + QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon") + KGlobal::dirs()->resourceDirs("xdgdata-icon"); QStringList::ConstIterator it; for (it=icnlibs.begin(); it!=icnlibs.end(); ++it) { --- branches/KDE/3.5/kdelibs/kdecore/kstandarddirs.cpp #576640:576641 @@ -100,6 +100,7 @@ "wallpaper", "lib", "pixmap", "templates", "module", "qtplugins", "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", + "xdgdata-icon", "kcfg", "emoticons", 0 }; static int tokenize( QStringList& token, const QString& str, @@ -1055,6 +1056,8 @@ return "lib" KDELIBSUFF "/kde3/plugins"; if (!strcmp(type, "xdgdata-apps")) return "applications/"; + if (!strcmp(type, "xdgdata-icon")) + return "icons/"; if (!strcmp(type, "xdgdata-dirs")) return "desktop-directories/"; if (!strcmp(type, "xdgconf-menu"))
SVN commit 601485 by lunakl: Add $XDG_DATA_DIRS/pixmaps to the icon lookup paths as well, even though it's not in the spec. E.g. some GNOME apps put their icons there :-/ CCBUG: 97776 M +2 -0 kiconloader.cpp M +4 -0 kicontheme.cpp M +3 -1 kstandarddirs.cpp --- branches/KDE/3.5/kdelibs/kdecore/kiconloader.cpp #601484:601485 @@ -246,6 +246,8 @@ dirs += d->mpDirs->resourceDirs("pixmap"); dirs += d->mpDirs->resourceDirs("xdgdata-icon"); dirs += "/usr/share/pixmaps"; + // These are not in the icon spec, but e.g. GNOME puts some icons there anyway. + dirs += d->mpDirs->resourceDirs("xdgdata-pixmap"); for (QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) d->mpDirs->addResourceDir("appicon", *it); --- branches/KDE/3.5/kdelibs/kdecore/kicontheme.cpp #601484:601485 @@ -108,6 +108,8 @@ icnlibs = KGlobal::dirs()->resourceDirs("icon"); icnlibs += KGlobal::dirs()->resourceDirs("xdgdata-icon"); icnlibs += "/usr/share/pixmaps"; + // These are not in the icon spec, but e.g. GNOME puts some icons there anyway. + icnlibs += KGlobal::dirs()->resourceDirs("xdgdata-pixmap"); for (it=icnlibs.begin(); it!=icnlibs.end(); ++it) { cDir = *it + name + "/"; @@ -471,6 +473,8 @@ QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon"); icnlibs += (KGlobal::dirs()->resourceDirs("xdgdata-icon")); icnlibs += "/usr/share/pixmaps"; + // These are not in the icon spec, but e.g. GNOME puts some icons there anyway. + icnlibs += KGlobal::dirs()->resourceDirs("xdgdata-pixmap"); QStringList::ConstIterator it; for (it=icnlibs.begin(); it!=icnlibs.end(); ++it) { --- branches/KDE/3.5/kdelibs/kdecore/kstandarddirs.cpp #601484:601485 @@ -100,7 +100,7 @@ "wallpaper", "lib", "pixmap", "templates", "module", "qtplugins", "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", - "xdgdata-icon", + "xdgdata-icon", "xdgdata-pixmap", "kcfg", "emoticons", 0 }; static int tokenize( QStringList& token, const QString& str, @@ -1058,6 +1058,8 @@ return "applications/"; if (!strcmp(type, "xdgdata-icon")) return "icons/"; + if (!strcmp(type, "xdgdata-pixmap")) + return "pixmaps/"; if (!strcmp(type, "xdgdata-dirs")) return "desktop-directories/"; if (!strcmp(type, "xdgconf-menu"))