dmikushin / tray

Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu.
MIT License
87 stars 16 forks source link

No tray icon on KDE #4

Open arabine opened 2 years ago

arabine commented 2 years ago

Hello,

There is no tray icon visible on KDE. I don't know where to start but I can propose a patch if someone has some hints.

dmikushin commented 1 year ago

Hi @arabine , thank you for reporting this. I think the issue is connected to the use of a special functional kind of icon, as explained below. I provide the following example for Gnome 3 Shell:

screenshot_linux.png

As you can see, the icon is set to "envelope" by the following lines of code:

#define TRAY_ICON1 "indicator-messages"
#define TRAY_ICON2 "indicator-messages-new"

My guess is that these two have no valid meaning in KDE and hence not respected, and tray icon is not shown at all.

I'd start by looking into how KDE encodes its special functional icons, such as notifications. A patch should offer a more portable way to use functional icons in different desktop environments.

Alternatively, you can specify a custom bitmap icon, and check whether it works in KDE (it should work out of the box). This could be a very useful test as well!

arabine commented 1 year ago

I tested with a standard icon name specified by the FreeDesktop and it works well on KDE: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

eg:

#define TRAY_ICON1 "mail-message-new"
#define TRAY_ICON2 "mail-message-new"

Screenshot_20230308_111945

I started a pull-request with multiple changes, including this topic.

dmikushin commented 1 year ago

Hi @arabine , thank you so much for working on this! I will review the PR #8 .

ReenigneArcher commented 1 year ago

I discovered that you can use your own icon if you place an svg directly in /usr/share/icons (I didn't test PNG, maybe that works as well). Only tested on Ubuntu. I tried using a subfolder, but it didn't work... maybe just need to define the icon differently in the code.

image

Then in your CMakeLists.txt

install(FILES "${CMAKE_SOURCE_DIR}/some-icon-name.svg" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")

Is it possible to define the full path to the image instead of just some-icon-name? I'd prefer to not install to that icon location if possible.

I also found this list of icons which are probably more universally supported. https://github.com/GNOME/gtk/blob/main/demos/icon-browser/icon.list

dmikushin commented 1 year ago

@ReenigneArcher , yes you are right, one way is to install icon into /usr/share/icons. Another way is to embed icon into a binary, and hope that a desktop support its extraction - I don't think it's a popular choice at least due to performance reasons. Please propose a patch how do you envision icon customization in CMake.

dmikushin commented 5 months ago

Dear all,

After this discussion @Rjvs has replaced GNOME-specific bindings with Qt6, which has been merged into the master branch of tray now. I would like to know what do you think of his solution. Do you still prefer to keep this appindicator solution for legacy purposes, or can it be dropped in favor of Qt6?