Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-01

How to get path to current theme icons on linux?

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

Hi,

I need to load icon associated by file extension. On windows I done this by WinAPI function ExtractAssociatedIcon(). On linux is not so easy, because we have GNOME, KDE, XFCE, LXDE etc, but I noticed that icons are stored in this same place (like /home/[account]/.icons/ or /usr/share/icons), so there is a chance to locate it, but how can I get path to icons which user using currently? Exists any GetEnvironmentVariable or something like this?

Regards

Michael Van Canneyt
to Krzysztof
Krzysztof wrote 9 lines
Hi, I need to load icon associated by file extension. On windows I done this by WinAPI function ExtractAssociatedIcon(). On linux is not so easy, because we have GNOME, KDE, XFCE, LXDE etc, but I noticed that icons are stored in this same place (like /home/[account]/.icons/ or /usr/share/icons), so there is a chance to locate it, but how can I get path to icons which user using currently? Exists any GetEnvironmentVariable or something like this?

Not to my knowledge.
You'll have to look in the settings files/directories of the GUI (GNOME/KDE/XFCE)

Michael.

Daniel Gaspary
to Krzysztof: I need to load icon associated by file extension. On windows I done this by WinAPI…
Krzysztof wrote
I need to load icon associated by file extension. On windows I done this by WinAPI function ExtractAssociatedIcon(). On linux is not so easy, because we have GNOME, KDE, XFCE, LXDE etc, but I noticed that icons are stored in this same place

I believe that file/dir locations are ruled by freedesktop specifications.I have found this:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#s2_layout

Krzysztof
to Krzysztof

Another problem. I know path to current icons, but icons are named like "office-spreadsheet" not by extension and can be in svg format :/ . So it seems that I must include icons of popular extensions in my application and do it by my self anyway.

2012/1/11 Krzysztof :

Show quoted text 12 lines
This is exactly what I needed! Thanks to all 2012/1/11 cobines : > Take a look at the unit here: > > http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/unix/uunixicontheme.pas > -- > cobines > _______________________________________________ > fpc-pascal maillist  -   > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >
cobines
to Krzysztof

2012/1/18 Krzysztof :

Another problem. I know path to current icons, but icons are named like "office-spreadsheet" not by extension and can be in svg format :/

Read this:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

There is a file "globs" that "contains a mapping from names to MIME types".

Therefore you can map for example "pdf" to "x-office-spreadsheet".

Look at sample code in function TPixMapManager.LoadMimeIconNames in

http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/upixmapmanager.pas

Once you have MIME name look here how to find the icon location in the icon theme:

http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/uicontheme.pas

cobines