Re: [gtk-osx-users] Preserving symlinks in bundle for themes





On Sun, Oct 15, 2017 at 3:05 AM, John Ralls <jralls ceridwen us> wrote:

> On Oct 14, 2017, at 4:50 PM, Jiří Techet <techet gmail com> wrote:
>
>
>
> On Sat, Oct 14, 2017 at 7:38 PM, John Ralls <jralls ceridwen us> wrote:
>
>
> > On Oct 14, 2017, at 2:58 AM, Jiří Techet <techet gmail com> wrote:
> >
> > Hi John,
> >
> > I've been playing with GTK3 version of Geany (GTK3 seems to be getting in a usable shape finally) and theming support. I used the Papirus icon theme, removed icons not needed for Geany and got to the size of about 6MB, which is acceptable. However, when creating bundle, all symlinks within the theme get replaced with copies of the files and the resulting size of the theme in bundle becomes about 50MB. This is by far the largest portion of the bundle.
> >
> > Is there some way to prevent this? It's clear that the bundler tries to avoid situations when symlinks lead to stuff outside the bundle but with icons, symlinks are always relative to the icon theme directory so having them in the bundle should be safe.
> >
> > I think there could be some option of the <icon-theme> tag in the bundle settings file so users who know that symlinks don't point outside the bundle can use it to keep the symlinks.
> >
> > What do you think?
> >
>
> You mean now that the first release of Gtk4 is out? :-/
>
> Unfortunately on OS X took a long time to get usable. Hopefully GTK 4 will be better.

Gtk4 is going to be heavily dependent on OpenGL. Apple has its own GL API that's different, so I'm not sure that Gtk4 will work at all on Quartz unless someone with serious GL chops gets involved and writes a backend for it.

Bad news then :-(.
 

>
> I don’t have a philosophical objection to copying symlinks into the bundle, but what’s getting symlinked and why? Why can’t you have a single copy of each file and call it by its name?
>
> Names in icon themes are standardized
>
> https://developer.gnome.org/icon-naming-spec/
>
> plus there are many names corresponding to various MIME types which can then be displayed using g_content_type_get_icon() dynamically for each file type you get using g_content_type_guess(). Icon themes use a single icon e.g. for several MIME types and these then symlink to a single physical image such as
>
> image-bmp.svg -> image-x-generic.svg
> image-gif.svg -> image-x-generic.svg
> image-jpeg.svg -> image-x-generic.svg
> image-png.svg -> image-x-generic.svg≈

>
> Try to get e.g. the Papirus icon theme I mentioned from
>
> https://github.com/PapirusDevelopmentTeam/papirus-icon-theme
>
> and check how symlinks are used. For instance, there's a directory 16x16 containing 16x16 SVG icons. Then there's a 16x16@2x directory which contains icons with 2x resolution for HiDPI displays and this one is just a symlink to the 16x16 directory. If you get the theme try to "cp -r" it to another location which creates a file copy of every symlink and compare the sizes - the difference is huge.
>
> This is not specific to this particular icon theme - basically all the icon themes you find do this trick to save space. So I think it would be useful to allow symlinks for icon themes to save some space in the bundle.
>

Yes, there's a list of standard icon names those names provide guidance to themes about what they need to provide. Themes are of course free to provide other ones as well, but there's no reason for them to have files with non-standard names and then symlink them to the standard names. Nobody's going to use the non-standard names.

About what non-standard icons are you talking about? It's clear that nobody will use non-standard ones. The ones I mentioned like image/bmp, image/png, etc. are completely standard MIME types and icons with the corresponding name have to exist for them in order to be shown - even though they can point to a single actual icon. Just check the freedesktop.org.xml file in the shared-mime-info package to see all MIME types for which icons should exist to be shown.
 

The 16x16@s directory is a symlink to the 16x16 directory (which is wrong, it should point to 32x32). It contains nothing on its own. The directory with quad-resolution icons for 16x16 is 32x32. 32x32 is as big as you'd want for an icon on a regular screen, so there's a 64x64 resolution directory for the HiDPI version.

For png icons it should indeed point to the double resolution. But as SVG icons are scaleable the theme points to the same non-@2-resolution and it works correctly because the SVG is scaled accordingly. Pointing to 32x32 would be incorrect - the 32-size icons typically contain a different set of icons (e.g. there are application icons, no toolbar icons, etc.) so themes never do that. It's not like iOS development.
 

There's two schools of thought about different size icons. One is that you draw the icons at high precision (open source folks will use Inkscape) and save them as SVGs and let the rendering software take care of the squashing. That's the approach used in the official Gnome themes. More finicky artists are unhappy with the results of letting the renderer do the squashing and want to tweak the SVG for each resolution. That's apparently the approach taken by the Papirus folks.

But back to bundling: You don't really want SVGs in your bundle at all, and if you're worried about size then you only want the icons you need, not all n000 x 12 that Papirus provides forgetting about all of the useless symlinks. I suggest that you write a script to grep through Geany, Gtk, and any other graphical dependencies you have and get a list of the icons you actually need, then renders those into pngs in each resolution and install them in $PREFIX/share/icons/Papirus, and then bundle those. You'll get better performance and you won't need to bundle librsvg.

I definitely don't need all icons and as I said, I removed a considerable amount of icons from the theme. But no matter what, I want to have all MIME-type icons which are heavily re-used through symlinks and also the @2 icons. I cannot go through Geany and check those statically - MIME types are determined depending on what files the user has and corresponding icons are shown in the file browser plugin. I don't want to re-render the icons as png's - the result is MUCH larger and I chose Papirus specifically because of the SVGs and because @2 icons can reuse the ordinary icons. And it's really not "useless symlinks" as you call them - the icon theme creators use them for a very good reason to save space.

Best regards,

Jiri


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]