对于X11系统,我试图在运行时更改应用程序的图标。这意味着窗口图标应该更改,图标显示在alt +标签菜单中,图标显示在统一栏中。
这是ubuntu的预览:
ubuntu没有窗口图标,但其他操作系统如metacity。
所以我在想这样使用XChangeProperty
:
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);
我在js-ctypes中执行此代码,但上面是我在研究过程中发现的C代码,这是否适用于运行应用程序?
由于