Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

draw mail count background with cairo #3

Merged
merged 2 commits into from
Nov 4, 2018
Merged

draw mail count background with cairo #3

merged 2 commits into from
Nov 4, 2018

Conversation

indigoxela
Copy link

Just in case, you were interested in mail count (number) shown in tray - this works for me.
I admit, it's just a workaround and this is my first contribution to a Thunderbird extension.

I wasn't able to figure out, why using an existing image as background to compose fails in current TB. But drawing with cairo works.

@firetray-updates
Copy link
Owner

firetray-updates commented Nov 3, 2018

I'm using appindicator, which doesn't support the counter. The icon looks otherwise blurry and pixelated, maybe because it uses a fixed size that is too small.

Anyway, I force disabled appindicator and I can see that the icon is completely broken. Firetray + appindicator uses system icons, while the GTK tray icon uses an image embedded in the xpi. Since the addon is not unpacked, it cannot be loaded. It's the same problem I found on Windows. Manually extracting the xpi fixes the problem, but your solution seems better.

Maybe you could make it easier to change the default size with something like the following:

    let w = 32;
    let h = 32;
    let border = 2;
    var mysurface = cairo.cairo_image_surface_create(cairo.CAIRO_FORMAT_ARGB32, w, h);
    var mycr = cairo.cairo_create(mysurface);
    cairo.cairo_rectangle(mycr, border, border, w - 2 * border, h - 2 * border);
    cairo.cairo_set_source_rgb(mycr, 0.85, 0.85, 0.85);
    cairo.cairo_fill_preserve(mycr);
    cairo.cairo_set_line_width(mycr, border);
    cairo.cairo_set_source_rgb(mycr, 0.4, 0.4, 0.4);
    cairo.cairo_stroke(mycr);
    let dest = gdk.gdk_pixbuf_get_from_surface(mysurface, 0, 0, w, h);

EDIT: border is already used, so a different name must be used. Or better yet, remove the existing border assignment and use border * 2 where it's currently used.

@indigoxela
Copy link
Author

indigoxela commented Nov 4, 2018

I'm using appindicator, which doesn't support the counter.

Appindicator means, your normal FireTray setting is to switch the icon?

Deleted some useless text here.

@indigoxela
Copy link
Author

Forget my previous two comments... too early, not enough coffee yet... ;)

@indigoxela
Copy link
Author

Updated my pull request, using some of your suggestions.

If your icon looks blurry, this might not the problem of the simple background square, but rather of the foreground (number), which is rendered beginning with line 290 in the same file (FiretrayGtkStatusIcon.jsm). I didn't touch anything there.

@firetray-updates firetray-updates merged commit 00eff4b into firetray-updates:thunderbird-57 Nov 4, 2018
@firetray-updates
Copy link
Owner

If your icon looks blurry, this might not the problem of the simple background square, but rather of the foreground (number), which is rendered beginning with line 290 in the same file (FiretrayGtkStatusIcon.jsm). I didn't touch anything there.

I don't know what makes the icon blurry, but the problem is not limited to the counter. Even the regular icon and custom icons look blurry. I've seen this happen with most of the application using XEmbed for the trayicon (I'm using KDE).

@indigoxela
Copy link
Author

the problem is not limited to the counter. Even the regular icon and custom icons look blurry

Weird thing. I'm using FireTray with gtk3 (xfce4-panel) and with regular system icons (Faenza icon set I suppose). Everything works and looks the same as it did with Thunderbird versions before 60.
The only thing that was broken for me, was the counter icon and I found a workaround for that.

But I don't know, how this all works, FireTray seems pretty complex to me.

@firetray-updates
Copy link
Owner

Oh, this isn't a regression, it's been this way for quite a while and the problem is not limited to Thunderbird. If I remember correctly Xembed icons (which should be what the gtk version of FireTray use) are limited to 22x22 pixels, so even with a not so high-res screen the icon looks blurry.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants