Re: Using symbolic icons in extensions
- From: Tim Cuthbertson <tim gfxmonk net>
- To: "Jasper St. Pierre" <jstpierre mecheye net>
- Cc: gnome-shell-list <gnome-shell-list gnome org>
- Subject: Re: Using symbolic icons in extensions
- Date: Sat, 5 May 2012 11:58:56 +1000
On Fri, May 4, 2012 at 9:35 PM, Jasper St. Pierre <jstpierre mecheye net> wrote:
> On Fri, May 4, 2012 at 7:24 AM, Tim Cuthbertson <tim gfxmonk net> wrote:
>> I've been trying to figure this out for a while, and it seems like it
>> can't be done.
>>
>> 1) I have got symbolic icons working in a shell extension panel
>> button, but *only* by setting the icon_name property on a St.Icon,
>> which requires icons be installed in a system location.
>>
>> 2) If I want to use an icon contained in my extension's folder, I have
>> to create a GIcon based on that path, and then assign it to the
>> St.Icon's `gicon` property.
>>
>> It seems I can't have both. Am I missing something? There doesn't seem
>> to be a way to construct a symbolic FileIcon, nor a way to
>> programmatically add my extension's icon location to the system icon
>> lookup-by-name mechanism. Surely it must be possible, can anyone help?
>
> A symbolic icon isn't anything magical. It's just an SVG with
> replaceable colors.
As an aside, the documentation on what a symbolic icon actually needs
to be is either nonexistent or far too hard to find. The only way I
found to possibly get it working was to use the scripts & svg source
in the gnome-icon-theme-symbolic projects, which does little to
promote their status as "not magic" ;)
> If you use St.Icon with a FileIcon, it should just
> work, assuming the file exists. All St.IconType.SYMBOLIC will try to
> do will be to append '-symbolic' to parts of the icon. We should
> probably scrap that code at some point - it was put in so we would
> have full-color fallbacks when not all of the symbolic icons were
> created yet, and those days are long gone :)
I did try that, and it didn't work. Or, at least, it didn't work as I
expected. Perhaps it's beyond the scope of just symbolic icons, but
when I loaded a GIcon from a file, it didn't get properly styled by
the shell (including rollover effect in the panel). When I use the
exact same icons and load them by name after adding them to
$XDG_DATA_DIRS, they got styled correctly including hover effects.
I even dove into the ST sources, as I can't find any docs. The
comments for the st_texture_cache_load_gicon function mention that:
* This will load @icon as a full-color icon; if you want a symbolic
* icon, you must use st_texture_cache_load_icon_name().
Which seems to back up what I'm seeing.
For now, I've done this, but it seems like a pretty bad (and
unobvious) solution, not even sure if it will be allowed past an
extension review:
https://github.com/gfxmonk/shellshape/blob/master/shellshape/indicator.js#L14
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]