Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def query_crtcs(self, root):
crtc_list = []
for crtc in self.ext.GetScreenResources(root).reply().crtcs:
crtc_info = self.ext.GetCrtcInfo(crtc, xcffib.CurrentTime).reply()
crtc_dict = {
"x": crtc_info.x,
"y": crtc_info.y,
"width": crtc_info.width,
"height": crtc_info.height,
}
crtc_list.append(crtc_dict)
return crtc_list
def finalize(self):
base._Widget.finalize(self)
atoms = self.qtile.conn.atoms
self.qtile.conn.conn.core.SetSelectionOwner(
0,
atoms['_NET_SYSTEM_TRAY_S{:d}'.format(self.screen)],
xcffib.CurrentTime,
)
self.hide()
win = qtile.conn.create_window(-1, -1, 1, 1)
window._Window.__init__(self, xcbq.Window(qtile.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 = 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)
def convert_selection(self, selection_atom, _type="UTF8_STRING") -> None:
type_atom = self.conn.atoms[_type]
self.conn.conn.core.ConvertSelection(
self._selection_window.wid,
selection_atom,
type_atom,
selection_atom,
xcffib.CurrentTime,
)