Understanding icon system


danielo515

Member
Joined
Dec 26, 2012
Messages
207
Hi!

 

I'm ready to start making my pandora what I bought it for: my ultra personalized handled personal computer.

 

What will be my first stop?

Understanding and using .desktop files.

 

So let's start with some eye-candy: icons.

 

I saw there are several icons in svg format, and there is also a tmp folder with png icons.

I Suppose every time pandora starts (or when needed) the svg icons are converted in png at that tmp folder.

My question is: how can I take advantage of this?

 

Can I suppose every SVG icon will be available as png with the same name so I can directly link to that icon in any .desktop file that I want to?

 

How can I add custom icons? Must be in SVG format at the previous mentioned folder? How applications set their icons? I did not see any of their icons in the SVG folder

 

Other topic: How can I make desktop shortcuts using .desktop files?

Thanks!
 
Ok, I did a bit more research

 

As far I understood, you can just name the icon if it is one of the "system standard". I call "standard" those icons which are at /usr/share/icons/

 

To make a desktop shortcut, just put the .desktop file in the desktop folder... this looks easy, but I've read somewhere this files are erased every time pandora is rebooted. Is this true or I made some misunderstanding?

 

 

EDIT

Found: In order to have a place for third party applications to install their icons there should always exist a theme called "hicolor" [1]. The data for the hicolor theme is available for download at: http://www.freedesktop.org/software/icon-theme/. Implementations are required to look in the "hicolor" theme if an icon was not found in the current theme.

 

The whole file is also interesting:

http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

 

 

This is getting more and more interesting

 


Icon Lookup

The icon lookup mechanism has two global settings, the list of base directories and the internal name of the current theme. Given these we need to specify how to look up an icon file from the icon name and the nominal size.

The lookup is done first in the current theme, and then recursively in each of the current theme's parents, and finally in the default theme called "hicolor" (implementations may add more default themes before "hicolor", but "hicolor" must be last)




Themes are described in files index.theme, but inside /usr/share/icons there are also a "PANDORA" folder, wich doesn't contain different sizes nor the index.theme file. Does this mean the "algorithm" will look into any folder contained at icons?

YES!

First all the directories are scanned for an exact match, e.g. one where the allowed size of the icon files match what was looked up. Then all the directories are scanned -I understand for the current theme - for any icon that matches the name. If that fails we finally fall back on unthemed icons.
 
Last edited by a moderator:
All PNDs contain icons in PNG format. When the pandora starts, a daemon called pndnotify-init extracts the icons, and puts them in /tmp/iconcache. There is no SVG -> PNG conversion.

Adding desktop shortcuts is, as you say, simply a matter of putting its desktop file into $HOME/Desktop. These files are not deleted on shutdown, but the icons they use are (because /tmp/iconcache only exists in memory). This is okay though, as the icon cache is recreated when you startup again.

When looking into .desktop files and icons for the pandora, it's useful to understand the role of pndnotify-init. When you add a new PND to a special folder like /media/SDCARD/pandora/menu, it scans the PND and creates a desktop file. If you put the PND into pandora/menu, it puts the desktop file into /usr/share/applications; if you put it in pandora/desktop, it puts the desktop file into $HOME/Desktop, and if you put it into pandora/apps, it puts it in both. It also extracts the icon and puts it into /tmp/iconcache, and does so every time you boot up.

To reiterate: desktop files are typically only created once, but icons are deleted and created on every reboot.

The icon that each application uses is set in its desktop file. You can change which icon an application uses by editing that file. Note, however, that if the application is from a PND, and you move the location of the PND (by ejecting the SD card the PND is on, for instance), then your changes will be lost.

Another thing to note is that desktop files for PNDs always contain an absolute path for icons (e.g. icon=/tmp/iconcache/game.png), but desktop files for applications on the nand just contain the name of the icon (e.g. icon=calculator). For these, the system looks in /usr/share/icons, and automatically finds the file in the most appropriate format (PNG), and in the most appropriate size (probably 64x64)
 
The .desktop system is a unix/linux standard system; see freedesktop.

For example:

http://standards.freedesktop.org/desktop-entry-spec/latest/

That is what I whas checking. Thanks.

All PNDs contain icons in PNG format. When the pandora starts, a daemon called pndnotify-init extracts the icons, and puts them in /tmp/iconcache. There is no SVG -> PNG conversion.


Adding desktop shortcuts is, as you say, simply a matter of putting its desktop file into $HOME/Desktop. These files are not deleted on shutdown, but the icons they use are (because /tmp/iconcache only exists in memory). This is okay though, as the icon cache is recreated when you startup again.


When looking into .desktop files and icons for the pandora, it's useful to understand the role of pndnotify-init. When you add a new PND to a special folder like /media/SDCARD/pandora/menu, it scans the PND and creates a desktop file. If you put the PND into pandora/menu, it puts the desktop file into /usr/share/applications; if you put it in pandora/desktop, it puts the desktop file into $HOME/Desktop, and if you put it into pandora/apps, it puts it in both. It also extracts the icon and puts it into /tmp/iconcache, and does so every time you boot up.


To reiterate: desktop files are typically only created once, but icons are deleted and created on every reboot.


The icon that each application uses is set in its desktop file. You can change which icon an application uses by editing that file. Note, however, that if the application is from a PND, and you move the location of the PND (by ejecting the SD card the PND is on, for instance), then your changes will be lost.


Another thing to note is that desktop files for PNDs always contain an absolute path for icons (e.g. icon=/tmp/iconcache/game.png), but desktop files for applications on the nand just contain the name of the icon (e.g. icon=calculator). For these, the system looks in /usr/share/icons, and automatically finds the file in the most appropriate format (PNG), and in the most appropriate size (probably 64x64)
WOW, WOW, WOW, I'm amazed.

You wrote all that text for me?

It's clear, easy to understand and accurate. THANK YOU!

This should be in the wiki or somewhere like that (actually it is currently on my personal knowledge repository -everN....)

This single text helped me much more than all the documentation I've read about linux regarding this topic.

The only single doubt that didn't leave me is: you mention that, for nand apps the system will look into the default /usr/share/icons... But I think this will happen for every value that is not an absolute path.

Again, thank you very much (this one is because I've checked your PNDs and I'm very thanked of what you've made for us :p )
 
That stuff is in the wiki .. look up 'libpnd hub' shoudl find too much information (not too easy to read I bet, since I wrote it ;)

(btw, its 'pndnotifyd' not 'pndnotify-init', but close enough)

The changes not necessarily lost.. you can make .ovr files that override some subset of the info in the PXML (ie: so you can rename an application); the .ovr (override) file contents will get emitted into the .desktop

For a different image, you can supply another png file; ie: if yo uhave foo.pnd, and suppyl foo.png in the same location, the PND system will use that png as an override icon image as well.

Icons are realtime scaled as needed.

ie: The .desktop mechanisms are standard

The PND system that generates the .desktops (for pnd files) is Pandora Magic, which he summed up quite nicely above :)

But you can of course have straight up .desktop applications or even command line binaries (no .desktop file at all), etc; the firmware includes a number of pure .desktop apps, though less over time... most firmware apps are included as pnds, or on the repo, etc.

..

If you have any specific ideas you need help with, let us all know.. as you can see, lots of crazy folks here ;)

jeff

libpnd hub: http://pandorawiki.org/Libpnd_hub

edit: See /etc/pandora for conf files for the pnd system; you can do lots of tricks as well.. have pnd's in NAND, or on SD; you can specify the search paths they are found in, and where .desktops are emitted to

If you fiddle with mmenu, you can reskin it to some extent, and change its behaviour, or ditch pndnotifyd/.desktop's entirely, and so on.

Pandora is crazy configurable :)
 
Last edited by a moderator:
The only single doubt that didn't leave me is: you mention that, for nand apps the system will look into the default /usr/share/icons... But I think this will happen for every value that is not an absolute path.
Yeah, that's true, sorry. There's nothing particularly special about nand apps. The .desktop files that are auto-generated from PNDs will always have values that are absolute paths (they'll always refer to /tmp/iconcache), but you can edit the .desktop files to just refer to a filename, and the system will automatically find it in /usr/share/icons.
 
Back
Top