I am using Fedora 5 with a Gnome Desktop version 2.14.0 and Libegg 1.2 to develop an application that will reside in the notification area (system tray).

I am trying to replace the standard context menu (menu with close, minimize, maximize etc.) of the icon in the notification area with my custom menu. Unfortunately, I'm not making any progress. So, can anybody help me with replacing or overriding the standard context menu with my custom menu?

BTW, I'm using the testtray.c found in Libegg as my starting point.

Also, is there any way to prevent multiple instances of the same executable? I want to prevent the end user from starting multiple copies of my application. For example, I want to convert the Windows version of this
HANDLE hMutex = CreateMutex(NULL, TRUE, UNIQUE);
if(GetLastError() == ERROR_ALREADY_EXISTS)
     // Application already running
     return FALSE;
to a Linux equivalent.