Search code examples
c++linuxdesktop-applicationsystem-tray

How can i make a tray icon in Linux using C++?


In Windows, I can use Shell_NotifyIcon(). What is the Linux equivalent of this function?

Is it different in GNOME (gtk) and KDE (qt)? Can't find any tutorials on the Internet.


Solution

  • Yes, it depends on a desktop environment you're using.

    In Qt (KDE), you can do this in a cross-platform manner using QSystemTrayIcon.

    There is even a sample application in Qt.

    In GTK, you do this with GtkStatusIcon. There is a sample application in this blog post.