简体   繁体   中英

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.

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 .

All major desktop support the current XEmbed based systray icon specification. Qt and GTK both provide facilities to use that protocol in comfortable manner. Regardless of your toolkit choice the icons will appear on all desktop environments. If you use Qt you get even compatability with other platforms like Windows for free.

For Gnome, there's this tutorial and the gtkmm toolkit for C++

EDIT: This is for panel applets, you asked for system tray icons. They're similar, but not quite the same. Go with Reed 's answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM