<div dir="ltr"><div>Hi,<br><br>In the <a href="http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html">current Desktop Entry Specification</a> (<a href="http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html">1.1</a>), it's possible to specify an icon for the directory (in case of a <span style="font-family: courier new,monospace;">.directory</span> file) or the <span style="font-family: courier new,monospace;">.desktop</span> file itself. Implementations are to follow this rule:<br>
</div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
Icon to display in file manager, menus, etc. If the
name is an absolute path, the given file will be
used. If the name is not an absolute path, the algorithm described
         in the <a class="ulink" href="http://freedesktop.org/wiki/Standards/icon-theme-spec" target="_top">Icon
         Theme Specification</a> will be used to locate the icon.<br></blockquote><div>The <a class="ulink" href="http://freedesktop.org/wiki/Standards/icon-theme-spec" target="_top">Icon
         Theme Specification</a> specifies that the icon should be seached for in a collection of paths related to the current theme.<br><br>I propose that we allow the usage of relative paths in some way also.<br><br><b>Use-cases</b><br>
<ol><li>I use a lot of <span style="font-family: courier new,monospace;">.directory</span> files to make directories containing a movie have the movie poster as the icon. This behaviour could apply to any form of media, like comic books, music (album art) and photos.</li>
<li>A vendor might want to bundle an icon to a piece of software they're distributing to go with a <span style="font-family: courier new,monospace;">.desktop</span> file which are not to go in the desktop menu and therefore are still located in the application directory.</li>
</ol></div><div><b>Current solutions</b><br><ol><li>I have a script looking for a specially named file (<span style="font-family: courier new,monospace;">.folder.png</span>) and when it finds one, it will create or update the <span style="font-family: courier new,monospace;">.directory</span> file in the same location as the icon file with the full path of it. Everytime I move a directory, mount it on another computer or just have a soft link I browse through, I have to rerun the script in the current path I'm using. Applications like Amarok will explicitly create the <span style="font-family: courier new,monospace;">.directory</span> file with the icon path set to the absolute path to the directory, plus the filename of the album art.<br>
</li><li>In this case, the install script must update the <span style="font-family: courier new,monospace;">.desktop</span> file with the full path to the icon, and hope that the user will never move this directory. A install script is now required even if it wasn't before.</li>
</ol></div><div><b>Proposed solutions</b><br>I propose that we allow the user to specify a relative path to a file to use as an icon. How we do this is not really important, but I have these separate suggestions (ordered by how it "should" work, IMHO):<br>
<ul><li>Icon paths starting with a dot will be relative from the directory containing the Desktop Entry; the path <span style="font-family: courier new,monospace;">./folder_icon.png</span> in <span style="font-family: courier new,monospace;">/home/user/Documents/BookProject/.directory</span> will set the icon to <span style="font-family: courier new,monospace;">/home/user/Documents/BookProject/folder_icon.png</span>.</li>
<li>When no absolute path is specified, first search the containing directory before following the Icon Theme Specification. In the example above, we would have entered <span style="font-family: courier new,monospace;">folder_icon.png<font face="arial,helvetica,sans-serif"> and this file would have been found locally before searching for it and therefore set.</font></span></li>
<li><span style="font-family: courier new,monospace;"><font face="arial,helvetica,sans-serif">Usage of some other prefix to denote a relative path, rules following the others<br></font></span></li><li><span style="font-family: courier new,monospace;"><font face="arial,helvetica,sans-serif">Using a different setting, or a compliment to the setting (like <span style="font-family: courier new,monospace;">Icon=...</span>, <span style="font-family: courier new,monospace;">IconPath=Relative</span>), rules following the others<br>
</font></span></li></ul></div><div><span style="font-family: courier new,monospace;"><font face="arial,helvetica,sans-serif">I do not think the first few would be that hard to implement, altough my knowledge in this area is a bit clouded. It is important to specify exactly where the relative path will apply from when loading the icon, and when this is done, it should be easy enough to do the rest. According to how I think would be best is to have the relative path apply to the directory <i>containing</i> the Desktop Entry. That is, if I use some form of file manager that follows the specs and I have the following structure:<br>
<br><font face="courier new,monospace">─+─ Projects<br> │<br> +─ BookProject<br> │ │<br> │ +─ .directory (Icon=./folder_icon.png)<br> │ +─ folder_icon.png<br> │ +─ (...)<br> │<br>
+─ SoftwareProject<br> │ <br> +─ .directory (Icon=./.project.png)<br> +─ .project.png<br> +─ gendocs.png<br> +─ Generate Documentation.desktop (Icon=./gendocs.png)<br>
+─ (...)<br><br></font></font></span><ul style="font-family: arial,helvetica,sans-serif;"><li>Visiting <span style="font-family: courier new,monospace;">SoftwareProject</span> would let me see a entry called <span style="font-family: courier new,monospace;">Generate Documentation</span> and have the <span style="font-family: courier new,monospace;">Projects/SoftwareProject/gendocs.png</span> file as an icon.</li>
<li>Visiting <span style="font-family: courier new,monospace;">BookProject</span> would let me see that the current directory have <span style="font-family: courier new,monospace;">Projects/BookProject/folder_icon.png</span> as the icon (if whis is displayed at all).</li>
<li>Visiting Projects will let me see two directories, BookProject and SoftwareProject, both having their respective icons correctly as expected.<br></li></ul></div><div>I would not be surprised if it's hard to do this in reality since the most simple things are often the hardest to do in a large codebase. It would also not surprise me if this is the reason it's not in the spec from the beginning... Perhaps we could make this easier if we specify that a local path going up a directory structure will be illegal and that the path must be from the directory downwards.<br>
<br>Anyway... Let's discuss!<br><br>PS. I hope this is the correct list to mail this to. If not, please direct me to where I should send this proposal. .DS<br><br></div><div>-- <br>Magnus Bergmark - magnus DOT bergmark AT gmail DOT com<br>
GPG/PGP: 0x7BE84794DB6AA648<br>Fingerprint: 0E6F D2DB F0EF 534A 2184 52AF 7BE8 4794 DB6A A648<br>
</div></div>