This forum has been archived. All content is frozen. Please use KDE Discuss instead.

API or system call to know current theme.

Tags: None
(comma "," separated)
rajatm
Registered Member
Posts
3
Karma
0
OS
Hi,
I am writing an application which registers icon for a mimetype.
But in KDE for registering an icon you need to put that icon in the theme folder.
i.e In case current theme is oxygen you need to copy your icons to $HOME/.local/share/icons/hicolor/

Hence i wanted to know if there is an API which gets me the current theme so that i can register icons for my application.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Hicolor is the generic fallback theme for virtually all icon themes.
For KDE applications, you can use KConfig to read "kdeglobals". Use the group "Icons" and read the value "Theme".


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
rajatm
Registered Member
Posts
3
Karma
0
OS
Thanks for the reply.

But i am looking for is a system binary available on KDE distros which tells us the theme, As i have using shell scripts to register the icons.

>> Hicolor is the generic fallback theme for virtually all icon themes

Hicolor was a typo. what i meant was the say if current theme is xyz then you need to add icons to $HOME/.local/share/icons/xyz folder in order to register the icons.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The following command should do the job. Note that if the theme hasn't been set, then the value may not be present.

Code: Select all
kreadconfig --group "Icons" --key "Theme"


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
I think it is more appropriate to use xdg-icon-resource for this kind of purpose (installing icons as part of an application installation process)

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
rajatm
Registered Member
Posts
3
Karma
0
OS
Yes i also tried to use the same , but xdg-icon-resource doesnt work on some of KDE distributions and Ubuntu 9.10.
So i want to change/modify the script to make it work on all distributions.
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
Have you checked why it didn't work?
Do they move the icon path somewhere non-standard?
Or not install the hicolor default fallback theme?

Anyway, since this is about installing, getting the current theme of a single user will only "help" for that respective user and only as long as the user does not change the theme.
This are two of the very reasons why there is "hicolor" theme which always exists and is always used for lookup if an icon is not found in the current them.

See second paragraph, first sentence here: http://standards.freedesktop.org/icon-t ... atest.html

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]