问题
For X11 systems I was trying to change the icon of the application during run time. This means that the window icon should change, the icon showed in alt+tab menu, and the icon in the unity bar.
This is preview of ubuntu:
ubuntu doesnt have a window icon, but other operating systems like metacity do.
So I was thinking of using XChangeProperty
like this:
unsigned int buffer[] = {16, 16, 4294901760..............., 32, 32, 0............}; //ARGB 32bit packed array
Display *d = XOpenDisplay(0);
int s = DefaultScreen(d);
Atom net_wm_icon = XInternAtom(d, "_NET_WM_ICON", False);
Atom cardinal = XInternAtom(d, "CARDINAL", False);
XEvent e;
//w == window
int length = 2 + 16 * 16 + 2 + 32 * 32;
XChangeProperty(d, w, net_wm_icon, cardinal, 32,
PropModeReplace, (const unsigned char*) buffer, length);
XMapWindow(d, w);
while(1) XNextEvent(d, &e);
I do this code in js-ctypes, but the above is C code i found during my research, will this work for running application?
Thanks
来源:https://stackoverflow.com/questions/26446847/xchangeproperty-to-change-icon-in-unity-bar-and-alt-tab-menu-and-window-of-runni