Maxim
Maxim

Reputation: 13468

How to diplay system tray icon using Mono (Linux)?

I am using GTK# 2.12 as it is described here.

But when I use a PNG image with transparency, KDE does not want to redraw the transparent parts of the image. So, I see the old bitmap (not panel bar) on transparent parts of image.

I guess that it can be bug inside GTK# itself. So, I am looking for a new way to display system tray icons using mono. Maybe some library over QSystemTrayIcon could do it. Ideally, it should be cross-platform. So, on Windows, it should also be displayed.

Alternatively, I can try to implement platform invoke for Linux version (maybe best option). But please give me some example... I am new for Qt and platform invocation in Linux.

Upvotes: 3

Views: 1875

Answers (1)

László Papp
László Papp

Reputation: 53215

I think you ought to try updating your gtk version since the version that you are trying to use is very old. It is like using Qt 3 or so. They were OK some ten years ago. It is quite possible that the bug was fixed a long while ago for such a basic functionality.

If you want to stick with ancient software, here is a Qt wrapper solution though just for the challenge of it.

QYoto from KDE is not that much maintained anymore, but it is probably still the best choice out of the wrappers, so here goes the example code for this:

using Qyoto;

class Program { 
    public static void Main(string[] args) { 
        new QApplication(args); 
        var tray = new QSystemTrayIcon(this);
        tray.SetIcon(new QIcon(":/gui/logo.png"));
        ...
        tray.Show();
        QApplication.Exec(); 
  }   
} 

Upvotes: 1

Related Questions