How to use the xcffib.xproto.Atom function in xcffib

To help you get started, we’ve selected a few xcffib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qtile / qtile / test / scripts / window.py View on Github external
print("Could not open window on display %s" % (sys.argv[1]), file=sys.stderr)
    sys.exit(1)

screen = conn.get_setup().roots[conn.pref_screen]

window = conn.generate_id()
background = conn.core.AllocColor(screen.default_colormap, 0x2828, 0x8383, 0xCECE).reply().pixel  # Color "#2883ce"
conn.core.CreateWindow(xcffib.CopyFromParent, window, screen.root,
                       100, 100, 100, 100, 1,
                       xcffib.xproto.WindowClass.InputOutput, screen.root_visual,
                       xcffib.xproto.CW.BackPixel | xcffib.xproto.CW.EventMask,
                       [background, xcffib.xproto.EventMask.StructureNotify | xcffib.xproto.EventMask.Exposure])

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, xcffib.xproto.Atom.WM_NAME,
                         xcffib.xproto.Atom.STRING, 8, len(sys.argv[2]),
                         sys.argv[2])

wm_protocols = "WM_PROTOCOLS"
wm_protocols = conn.core.InternAtom(0, len(wm_protocols), wm_protocols).reply().atom

wm_delete_window = "WM_DELETE_WINDOW"
wm_delete_window = conn.core.InternAtom(0, len(wm_delete_window), wm_delete_window).reply().atom

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, wm_protocols,
                         xcffib.xproto.Atom.ATOM, 32, 1,
                         [wm_delete_window])

conn.core.ConfigureWindow(window,
                          xcffib.xproto.ConfigWindow.X | xcffib.xproto.ConfigWindow.Y |
                          xcffib.xproto.ConfigWindow.Width | xcffib.xproto.ConfigWindow.Height |
github qtile / qtile / test / scripts / window.py View on Github external
else:
    print("Could not open window on display %s" % (sys.argv[1]), file=sys.stderr)
    sys.exit(1)

screen = conn.get_setup().roots[conn.pref_screen]

window = conn.generate_id()
background = conn.core.AllocColor(screen.default_colormap, 0x2828, 0x8383, 0xCECE).reply().pixel  # Color "#2883ce"
conn.core.CreateWindow(xcffib.CopyFromParent, window, screen.root,
                       100, 100, 100, 100, 1,
                       xcffib.xproto.WindowClass.InputOutput, screen.root_visual,
                       xcffib.xproto.CW.BackPixel | xcffib.xproto.CW.EventMask,
                       [background, xcffib.xproto.EventMask.StructureNotify | xcffib.xproto.EventMask.Exposure])

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, xcffib.xproto.Atom.WM_NAME,
                         xcffib.xproto.Atom.STRING, 8, len(sys.argv[2]),
                         sys.argv[2])

wm_protocols = "WM_PROTOCOLS"
wm_protocols = conn.core.InternAtom(0, len(wm_protocols), wm_protocols).reply().atom

wm_delete_window = "WM_DELETE_WINDOW"
wm_delete_window = conn.core.InternAtom(0, len(wm_delete_window), wm_delete_window).reply().atom

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, wm_protocols,
                         xcffib.xproto.Atom.ATOM, 32, 1,
                         [wm_delete_window])

conn.core.ConfigureWindow(window,
                          xcffib.xproto.ConfigWindow.X | xcffib.xproto.ConfigWindow.Y |
github qtile / qtile / test / scripts / window.py View on Github external
[background, xcffib.xproto.EventMask.StructureNotify | xcffib.xproto.EventMask.Exposure])

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, xcffib.xproto.Atom.WM_NAME,
                         xcffib.xproto.Atom.STRING, 8, len(sys.argv[2]),
                         sys.argv[2])

wm_protocols = "WM_PROTOCOLS"
wm_protocols = conn.core.InternAtom(0, len(wm_protocols), wm_protocols).reply().atom

wm_delete_window = "WM_DELETE_WINDOW"
wm_delete_window = conn.core.InternAtom(0, len(wm_delete_window), wm_delete_window).reply().atom

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, wm_protocols,
                         xcffib.xproto.Atom.ATOM, 32, 1,
                         [wm_delete_window])

conn.core.ConfigureWindow(window,
                          xcffib.xproto.ConfigWindow.X | xcffib.xproto.ConfigWindow.Y |
                          xcffib.xproto.ConfigWindow.Width | xcffib.xproto.ConfigWindow.Height |
                          xcffib.xproto.ConfigWindow.BorderWidth,
                          [0, 0, 100, 100, 1])
conn.core.MapWindow(window)
conn.flush()
conn.core.ConfigureWindow(window,
                          xcffib.xproto.ConfigWindow.X | xcffib.xproto.ConfigWindow.Y |
                          xcffib.xproto.ConfigWindow.Width | xcffib.xproto.ConfigWindow.Height |
                          xcffib.xproto.ConfigWindow.BorderWidth,
                          [0, 0, 100, 100, 1])

try:
github mjkillough / set-wallpaper / set_wallpaper.py View on Github external
def _get_pixmap_property(self, name):
        reply = self.conn.core.GetProperty(
            False, self.root, self._intern_atom(name),
            xcffib.xproto.Atom.PIXMAP, 0, 32
        ).reply()
        if not reply.value_len:
            return None
        return struct.unpack('I', reply.value.buf())[0]
github qtile / qtile / libqtile / backend / x11 / xcbq.py View on Github external
def __init__(self, conn):
        self.conn = conn
        self.atoms = {}
        self.reverse = {}

        # We can change the pre-loads not to wait for a return
        for name in WindowTypes.keys():
            self.insert(name=name)

        for i in dir(xcffib.xproto.Atom):
            if not i.startswith("_"):
                self.insert(name=i, atom=getattr(xcffib.xproto.Atom, i))
github qtile / qtile / libqtile / backend / x11 / xcbq.py View on Github external
"""Tries to retrieve a canonical window name.

        We test the following properties in order of preference:
            - _NET_WM_VISIBLE_NAME
            - _NET_WM_NAME
            - WM_NAME.
        """
        r = self.get_property("_NET_WM_VISIBLE_NAME", "UTF8_STRING")
        if r:
            return self._property_utf8(r)

        r = self.get_property("_NET_WM_NAME", "UTF8_STRING")
        if r:
            return self._property_utf8(r)

        r = self.get_property(xcffib.xproto.Atom.WM_NAME, "UTF8_STRING")
        if r:
            return self._property_utf8(r)

        r = self.get_property(
            xcffib.xproto.Atom.WM_NAME,
            xcffib.xproto.GetPropertyType.Any
        )
        if r:
            return self._property_string(r)
github qtile / qtile / libqtile / backend / x11 / xcbq.py View on Github external
def __init__(self, conn):
        self.conn = conn
        self.atoms = {}
        self.reverse = {}

        # We can change the pre-loads not to wait for a return
        for name in WindowTypes.keys():
            self.insert(name=name)

        for i in dir(xcffib.xproto.Atom):
            if not i.startswith("_"):
                self.insert(name=i, atom=getattr(xcffib.xproto.Atom, i))
github qtile / qtile / libqtile / backend / x11 / xcbq.py View on Github external
def ungrab_button(self, button, modifiers):
        """Passing None means any key, or any modifier"""
        if button is None:
            button = xcffib.xproto.Atom.Any
        if modifiers is None:
            modifiers = xcffib.xproto.ModMask.Any
        self.conn.conn.core.UngrabButton(button, self.wid, modifiers)