Tdesktop: Make tray icon themeable

Created on 16 Apr 2016  ·  31Comments  ·  Source: telegramdesktop/tdesktop

Steps to reproduce

  1. Open telegram on Linux
  2. Enable tray icon

    Expected behaviour

Icon from generic place like /usr/share/icons/hicolor is used instead of a hardcoded one, so that different icon themes can provide tray icons for telegram instead of a hardcoded png.

Actual behaviour

An icon that is hardcoded in the binary is used, with absolutely no way to change apart from building telegramDesktop from source with changed png files...

Configuration

Ubuntu 15.10 with appindicator installed

Telegram version 0.9.33

enhancement ui

All 31 comments

Shouldn't #1431 fix this issue?

I don't think so because this is only for the app icon (the icon that shows up in the unity launcher for example), whereas the tray icon is still hardcoded.

If I made a pull request, is this something you would consider merging?

EDIT: Relevant #419

Duplicate #1199

If I made a pull request, is this something you would consider merging?

Yes, a PR would be great 👍

What will happen with the coloured unread counters that are placed upon the icon (currently red or grey, depending on the muted status of the conversations with a positive unread counter)? They will be placed that way above an arbitrary tray icon?

I suppose that's up to the icon theme to decide. If they ship icons for all different states, they should show up

@wa4557 I just don't understand (and afraid a bit) how this is going to look in the pull request — the counter is added uniformly there using internal styles.

Is it? As far as I understand the code there are a lot of different png files for all different counter values. So for me there's not really a difference if this is done internally (this will be the fallback oc), or via an icon theme

I could be wrong though, and misunderstand the code...

Any news on this? Plasma uses the theme icon but the status bar still shows the original blue icon

teleg1
teleg2

@wa4557 Did you make some progress on this issue?

Ah yeah I thought I commented on that. I coded around only to find out, that this wont work. The problem is that telegram doesn't use system Qt libraries, which consequentely means that the icon theme used is not recognized (I'm not sure how this is done by system Qt).

So this means that I was not able to use icons from hicolor or other icon themes

Would you at least keep/distribute a directory named 'icons' with the icon? Also embed the default icon in the binary as it's done now in case the icon gets deleted. While this won't work with general themes, at least the interested users can switch the icon.

Maybe don't even ship the icon, but load it on launch if it's present.

@wa4557

The problem is that telegram doesn't use system Qt libraries, which consequentely means that the icon theme used is not recognized (I'm not sure how this is done by system Qt).

But it works for the app icon .. ? #1431

Well that's a different story.

In order for telegram using system tray icons, I need the QIcon::fromTheme method, which as I said doesn't work with non system Qt libraries.

For the app icon it is as simple as changing a line in the .desktop file from Icon=/path/to/a/hardcoded/icon.png to a simple Icon=telegram the rest is done by the DE.

EDIT: I would argue, that line L524 in your linked commit could be deleted, the important thing is L1199

@DavidVentura Yeah this might work. This used to work on Ubuntu but Unity doesn't use AppIndicator anymore, and the icons are created on the fly by the program. I guess this could be changed though

Would it be possible to try and load an external file if it exists, and if it doesn't just fall back to the current icon (embedded in the binary)?

@DavidVentura This is what I'm trying to do right now. We'll see if it works

EDIT: I opened a PR to implement what @DavidVentura suggested. The code in general is a bit convoluted though, with a lot of redunand functions that are doing basically the same, for different flags. Cleaning the code is not the purpose of this PR though

This hack, modified for your color/icon preferences, may be useful for some of you until this is sorted.

EDIT: or this one.

1199 ?

@Aokromes that is for the application icon, not the tray.

I had this themed with the following custom icons, and many symlinks for different message counts, in ~/.local/share/TelegramDesktop/tdata/ticons:

ico_22_1.png
icomute_22_0.png
icomute_22_1.png
icon_22_0.png
icon_22_1.png
icon_22_2.png
icon_22_3.png

But it seems with the latest update from 1.5.4 to 1.5.8 the tray icon has reverted to the blinding blue out-of-place icon. Did the necessary location or names of the custom icons change?

@AndydeCleyre The name changed from ico to icon.

So after #7111, in order to choose the tray icon displayed on plasma desktop, the proper way becomes to have icons in the theme named telegram-{,attention-,mute-}panel?

@AndydeCleyre +

Is this in 1.9.12?

image

image

Yep

How can I debug this, then?

Looks like the regression is now being discussed at #7192.

No solution for Windows 10 users?

No solution for Windows 10 users?

There is no such thing as "system icon theme" on Windows AFAIK

True but, after seeing #3301 and #1353 closed in favor of this issue, closed too, I wanted to remind or at least confirm if we are just out of luck.

True but, after seeing #3301 and #1353 closed in favor of this issue, closed too

Since things changed, I think, you can open new issue
Or ask @Aokromes to reopen one of them (they have examples of how that can be done and discussion)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beppe9000 picture beppe9000  ·  3Comments

JhonSane picture JhonSane  ·  3Comments

Mindstormer619 picture Mindstormer619  ·  3Comments

hosseinab picture hosseinab  ·  3Comments

TheAppService picture TheAppService  ·  3Comments