4 char *xprop_names[] = {
13 "_NET_WM_STATE_SKIP_TASKBAR",
14 "_NET_WM_STATE_SHADED",
15 "_NET_WM_STATE_BELOW",
16 "_NET_WM_STATE_HIDDEN",
18 "_NET_WM_WINDOW_TYPE",
19 "_NET_WM_WINDOW_TYPE_DOCK",
21 "_NET_WM_ICON_GEOMETRY",
26 "_NET_CLIENT_LIST_STACKING",
27 "_NET_NUMBER_OF_DESKTOPS",
28 "_NET_CURRENT_DESKTOP",
32 "_NET_RESTACK_WINDOW",
36 void xprop_init(screen *sc)
38 XInternAtoms(sc->dd, xprop_names, XPROP_COUNT, False, sc->atoms);
41 void* xprop_get_data(screen *sc, Window win, xprop_t prop, Atom type, int *items)
45 unsigned long items_ret;
46 unsigned long after_ret;
47 unsigned char *prop_data;
51 XGetWindowProperty(sc->dd, win, sc->atoms[prop], 0, 0x7fffffff, False, type, &type_ret,
52 &format_ret, &items_ret, &after_ret, &prop_data);
59 int xprop_get_num(screen *sc, Window win, xprop_t p)
64 data = xprop_get_data(sc, win, p, XA_CARDINAL, 0);
72 char* xprop_get_utf8(screen *sc, Window win, xprop_t p)
74 return xprop_get_data(sc, win, p, sc->atoms[UTF8_STRING], 0);
77 char* xprop_get_string(screen *sc, Window win, xprop_t p)
79 return xprop_get_data(sc, win, p, XA_STRING, 0);
82 void xprop_set_num(screen *sc, Window win, xprop_t p, long val)
84 XChangeProperty(sc->dd, win, sc->atoms[p], XA_CARDINAL, 32,
85 PropModeReplace, (unsigned char *)&val, 1);
88 void xprop_set_atom(screen *sc, Window win, xprop_t p, xprop_t at)
90 XChangeProperty(sc->dd, win, sc->atoms[p], XA_ATOM, 32,
91 PropModeReplace, (unsigned char *)&sc->atoms[at], 1);
94 void xprop_set_array(screen *sc, Window win, xprop_t p, const long *vals, int num)
96 XChangeProperty(sc->dd, win, sc->atoms[p], XA_CARDINAL, 32, PropModeReplace,
97 (unsigned char *)vals, num);
100 void xprop_set_string(screen *sc, Window win, xprop_t p, const char *s)
102 XChangeProperty(sc->dd, win, sc->atoms[p], XA_STRING, 8, PropModeReplace,
103 (unsigned char *)s, strlen(s));