Mad Fish
Mad Fish

Reputation: 713

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.

Upvotes: 3

Views: 5597

Answers (3)

Reed Copsey
Reed Copsey

Reputation: 564771

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.

Upvotes: 6

sebasgo
sebasgo

Reputation: 3861

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.

Upvotes: 3

Michiel Buddingh
Michiel Buddingh

Reputation: 5919

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.

Upvotes: 0

Related Questions