Exemplo n.º 1
0
    def _configure(self, qtile, bar):
        base._Widget._configure(self, qtile, bar)

        if self.configured:
            return

        self.conn = conn = qtile.core.conn
        win = conn.create_window(-1, -1, 1, 1)
        window._Window.__init__(self, window.XWindow(conn, win.wid), qtile)
        qtile.windows_map[win.wid] = self

        # Even when we have multiple "Screen"s, we are setting up as the system
        # tray on a particular X display, that is the screen we need to
        # reference in the atom
        if qtile.current_screen:
            self.screen = qtile.current_screen.index
        self.bar = bar
        atoms = conn.atoms

        conn.conn.core.SetSelectionOwner(
            win.wid, atoms['_NET_SYSTEM_TRAY_S{:d}'.format(self.screen)],
            xcffib.CurrentTime)
        data = [
            xcffib.CurrentTime,
            atoms['_NET_SYSTEM_TRAY_S{:d}'.format(self.screen)], win.wid, 0, 0
        ]
        union = ClientMessageData.synthetic(data, "I" * 5)
        event = ClientMessageEvent.synthetic(format=32,
                                             window=qtile.core._root.wid,
                                             type=atoms['MANAGER'],
                                             data=union)
        qtile.core._root.send_event(event, mask=EventMask.StructureNotify)
Exemplo n.º 2
0
    def _configure(self, qtile, bar):
        base._Widget._configure(self, qtile, bar)
        win = qtile.conn.create_window(-1, -1, 1, 1)
        window._Window.__init__(self, xcbq.Window(qtile.conn, win.wid), qtile)
        qtile.windowMap[win.wid] = self

        # Even when we have multiple "Screen"s, we are setting up as the system
        # tray on a particular X display, that is the screen we need to
        # reference in the atom
        if qtile.currentScreen:
            self.screen = qtile.currentScreen.index
        self.bar = bar
        atoms = qtile.conn.atoms

        qtile.conn.conn.core.SetSelectionOwner(
            win.wid,
            atoms['_NET_SYSTEM_TRAY_S{:d}'.format(self.screen)],
            xcffib.CurrentTime
        )
        data = [
            xcffib.CurrentTime,
            atoms['_NET_SYSTEM_TRAY_S{:d}'.format(self.screen)],
            win.wid, 0, 0
        ]
        union = ClientMessageData.synthetic(data, "I" * 5)
        event = ClientMessageEvent.synthetic(
            format=32,
            window=qtile.root.wid,
            type=atoms['MANAGER'],
            data=union
        )
        qtile.root.send_event(event, mask=EventMask.StructureNotify)
Exemplo n.º 3
0
    def _configure(self, qtile, bar):
        base._Widget._configure(self, qtile, bar)
        self.qtile = qtile
        self.bar = bar
        atoms = qtile.conn.atoms
        win = qtile.conn.create_window(-1, -1, 1, 1)
        self.traywin = TrayWindow(win, self.qtile, self)
        qtile.windowMap[win.wid] = self.traywin
        qtile.conn.conn.core.SetSelectionOwner(
            win.wid,
            atoms['_NET_SYSTEM_TRAY_S0'],
            xcffib.CurrentTime
        )
        data = [
            xcffib.CurrentTime,
            atoms['_NET_SYSTEM_TRAY_S0'],
            win.wid, 0, 0
        ]
        union = ClientMessageData.synthetic(data, "I" * 5)
        event = ClientMessageEvent.synthetic(
            format=32,
            window=qtile.root.wid,
            type=atoms['MANAGER'],
            data=union
        )
        qtile.root.send_event(event, mask=EventMask.StructureNotify)

        # cleanup before exit
        atexit.register(self.cleanup)
Exemplo n.º 4
0
    def _configure(self, qtile, bar):
        base._Widget._configure(self, qtile, bar)

        if self.configured:
            return

        if Systray._instances > 0:
            raise ConfigError("Only one Systray can be used.")

        self.conn = conn = qtile.core.conn
        win = conn.create_window(-1, -1, 1, 1)
        window._Window.__init__(self, window.XWindow(conn, win.wid), qtile)
        qtile.windows_map[win.wid] = self

        # window._Window.__init__ overwrites the widget name so we need to restore it
        self.name = self._name

        # Even when we have multiple "Screen"s, we are setting up as the system
        # tray on a particular X display, that is the screen we need to
        # reference in the atom
        if qtile.current_screen:
            self.screen = qtile.current_screen.index
        self.bar = bar
        atoms = conn.atoms

        # We need tray to tell icons which visual to use.
        # This needs to be the same as the bar/widget.
        # This mainly benefits transparent bars.
        conn.conn.core.ChangeProperty(
            xcffib.xproto.PropMode.Replace,
            win.wid,
            atoms["_NET_SYSTEM_TRAY_VISUAL"],
            xcffib.xproto.Atom.VISUALID,
            32,
            1,
            [self.drawer._visual.visual_id],
        )

        conn.conn.core.SetSelectionOwner(
            win.wid, atoms["_NET_SYSTEM_TRAY_S{:d}".format(self.screen)],
            xcffib.CurrentTime)
        data = [
            xcffib.CurrentTime,
            atoms["_NET_SYSTEM_TRAY_S{:d}".format(self.screen)],
            win.wid,
            0,
            0,
        ]
        union = ClientMessageData.synthetic(data, "I" * 5)
        event = ClientMessageEvent.synthetic(format=32,
                                             window=qtile.core._root.wid,
                                             type=atoms["MANAGER"],
                                             data=union)
        qtile.core._root.send_event(event, mask=EventMask.StructureNotify)

        Systray._instances += 1
Exemplo n.º 5
0
    def _configure(self, qtile, bar):
        base._Widget._configure(self, qtile, bar)
        win = qtile.conn.create_window(-1, -1, 1, 1)
        window._Window.__init__(self, xcbq.Window(qtile.conn, win.wid), qtile)
        qtile.windowMap[win.wid] = self

        self.bar = bar
        atoms = qtile.conn.atoms

        qtile.conn.conn.core.SetSelectionOwner(
            win.wid, atoms["_NET_SYSTEM_TRAY_S{}".format(self.bar.screen.index)], xcffib.CurrentTime
        )
        data = [xcffib.CurrentTime, atoms["_NET_SYSTEM_TRAY_S{}".format(self.bar.screen.index)], win.wid, 0, 0]
        union = ClientMessageData.synthetic(data, "I" * 5)
        event = ClientMessageEvent.synthetic(format=32, window=qtile.root.wid, type=atoms["MANAGER"], data=union)
        qtile.root.send_event(event, mask=EventMask.StructureNotify)
Exemplo n.º 6
0
    def _configure(self, qtile, bar):
        base._Widget._configure(self, qtile, bar)
        self.qtile = qtile
        self.bar = bar
        atoms = qtile.conn.atoms
        win = qtile.conn.create_window(-1, -1, 1, 1)
        self.traywin = TrayWindow(win, self.qtile, self)
        qtile.windowMap[win.wid] = self.traywin
        qtile.conn.conn.core.SetSelectionOwner(win.wid,
                                               atoms['_NET_SYSTEM_TRAY_S0'],
                                               xcffib.CurrentTime)
        data = [
            xcffib.CurrentTime, atoms['_NET_SYSTEM_TRAY_S0'], win.wid, 0, 0
        ]
        union = ClientMessageData.synthetic(data, "I" * 5)
        event = ClientMessageEvent.synthetic(format=32,
                                             window=qtile.root.wid,
                                             type=atoms['MANAGER'],
                                             data=union)
        qtile.root.send_event(event, mask=EventMask.StructureNotify)

        # cleanup before exit
        atexit.register(self.cleanup)