import xcb import xcb.xproto def atom(conn, name): """Return an atom given its name""" name_bytes = list(ord(c) for c in name) voidcookie = conn.core.InternAtom(False, len(name_bytes), name_bytes) reply = voidcookie.reply() return reply.atom def atom_name(conn, atom): voidcookie = conn.core.GetAtomName(atom) reply = voidcookie.reply() name = "".join(chr(byte) for byte in reply.name) return name conn = xcb.connect() root_window = conn.get_setup().roots[0].root XA_ATOM = atom(conn, "ATOM") XA_NET_SUPPORTED = atom(conn, "_NET_SUPPORTED") # Get the _NET_SUPPORTED property voidcookie = conn.core.GetProperty( False, # delete root_window, # window XA_NET_SUPPORTED, # property XA_ATOM, # type 0, # long_offset 65535) # long_length reply = voidcookie.reply() print "root_window = %d (0x%x)" % (root_window, root_window) print "XA_ATOM = %d (0x%x)" % (XA_ATOM, XA_ATOM) print "XA_NET_SUPPORTED = %d (0x%x)" % (XA_NET_SUPPORTED, XA_NET_SUPPORTED) print "reply.format = %r" % (reply.format,) print "reply.type = %r (%r)" % (reply.type, atom_name(conn, reply.type)) print "reply.bytes_after = %r" % (reply.bytes_after,) print "reply.value_len = %r" % (reply.value_len,) print "len(reply.value) = %r" % (len(reply.value),) print "reply.value = %r" % (list(reply.value),)