XChangeProperty改变团结酒吧和alt标签菜单和运行程序的窗口图标?(XChangePr

2019-10-21 04:13发布

对于X11系统上,我试图在运行时改变应用程序的图标。 这意味着,窗口图标应该改变,图标显示在ALT + TAB菜单,并在统一栏中的图标。

这是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代码我的研究过程中,我发现,将这项工作运行的应用程序?

谢谢

文章来源: XChangeProperty to change icon in unity bar and alt tab menu and window of running app?
标签: icons x11 xorg