icon

GTK: Trayicon with effective 2 lines of C-Code

Sven Bachmann
Because I always wanted to learn some GTK, I decided to try it first with a trayicon. And wow, it was that easy - ok, the functional factor is zero, but you’ll have a trayicon with a tooltip. And if you want more you can read the GTK documentation and extend it to the max.So here it is: trayicon.c #include <gtk/gtk.h> int main(int argc, char *argv[]) { gtk_init (&argc;, &argv;); GtkStatusIcon *status = gtk_status_icon_new_from_stock(GTK_STOCK_NO); gtk_status_icon_set_tooltip(status, "Nice Tooltip"); gtk_main(); return 0; } As you can see, beside the C-Standard header and footer, and also the GTK header and footer, we have only two lines of code.