You are not logged in.
Can someone point to a sample code to implement an icon on the notification area using the freedesktop standard from http://www.freedesktop.org/wiki/Standar … ray_2dspec
And if possible, a sample which uses only GTK/Xfree calls, no Gnome, or QT/KDE libs please.
Offline
http://www-106.ibm.com/developerworks/l … ry/l-wrap/
That page is wrapping python over the top of a C module, so if you're smart enough you ought to be able to work out the C module it's using. Either way, you could also do it in python too
Offline
int format;
long nitems, bytes, *data;
Atom type, net_wm_icon = XInternAtom(display,"_NET_WM_ICON",False);
XGetWindowProperty(display,window,net_wm_icon,0, MAX_LONG,False, XA_CARDINAL,
&type,&fmt,&nitems,&bytes,(unsigned char **)&data);
//...data now has pixel values for icon
that's how to *get* and icon from the application... you'd just need to use that data to draw the icon.... that depends entirely on whatever you're doing
Offline
Hi,
I think you can have a look at sylpheeds systray-icon, it's all in one .c file
using gtk or gtk2, depends on which version you use. It implemets a lot of
functionality, hiding , right-click, procedure calls ...
-ner
Offline
thanks a lot for the info and samples, I will give it a look.
Offline
oh wait - you're looking for sys-tray... the netWM stuff I listed was for the embedded icon that's displayed in taskbars/titlebars... i.e. firefox has it's icon next to it when listed on a netWM compatible panel.
Offline
yes, I already has the icon, I only want to put that Icon on the system tray when the main window is closed, for example like Gaim do. I'm currently studying the gaim source.
I want to do that with X, or GTK2 code. Do not want any Gnome code at all. The less bindings to gnome it has, the more attractive at the end the program will be for non gnome users.
Offline
Well, to do it with raw Xlib, you can use the following to dock the new window:
/*** NOTE:
tray_icon is the window which you want docked
It should support: _NET_WM_NAME, WM_CLASS, _NET_WM_ICON
I'm not sure if the window actually needs any visual representation... the _NET_WM_ICON may handle it
***/
Window tray_icon, systray;
unsigned long xembed_info[2];
XEvent e;
//Set XEMBED info
xembed_info[0] = 0;
xembed_info[1] = 0;
XChangeProperty(display, tray_icon,
XInternAtom(display, "_XEMBED_INFO", False ),
XInternAtom(display, "_XEMBED_INFO", False ),
32, PropModeReplace, (unsigned char*)xembed_info, 2);
//systray window
//NOTE: _NET_SYSTEM_TRAY_Sx where x is Screen#
// You can use DefaultScreen(...) to get the actual #
systray = XGetSelectionOwner(display, XInternAtom(display, "_NET_SYSTEM_TRAY_S0", False ),
//now dock into the systray
e.xclient.type = ClientMessage;
e.xclient.window = systray;
e.xclient.message_type = XInternAtom (display, "_NET_SYSTEM_TRAY_OPCODE", False );
e.xclient.format = 32;
e.xclient.data.l[0] = CurrentTime;
e.xclient.data.l[1] = SYSTEM_TRAY_REQUEST_DOCK;
e.xclient.data.l[2] = tray_icon;
e.xclient.data.l[3] = 0;
e.xclient.data.l[4] = 0;
XSendEvent(display, systray, False, NoEventMask, &e);
XSync(display, False);
This isn't guarenteed to work... I've done it once before, but this was written in the forums, so who knows what crazy errors I introduced... take it with a grain of salt - I'm assuming you know what you're doing and can make this work
Offline