def __init__(self, conn): self.conn = conn setup = self.conn.get_setup() self.current_workspace = None self.screen = Screen(self.conn, setup.roots[0], self) self.root = self.screen.root self.win_store = WindowStore(self.conn, self, []) self.swap_win = None self.swaps = 0 self.default_cursor = cursor.create_font_cursor( cursor.FontCursor.LeftPtr) self.move_cursor = cursor.create_font_cursor(cursor.FontCursor.Fleur) self.workspaces = [] self.current_workspace_num = 1 self.current_name = 'Desktop' self.current_win = None self.logger = logger.DzenLogger(self) #Proclaim to all just what we support atoms = [ "_NET_WM_STRUT_PARTIAL", "_NET_WM_STATE_FULLSCREEN", "_NET_NUMBER_OF_DESKTOPS", "_NET_CURRENT_DESKTOP", "_NET_ACTIVE_WINDOW" ] atom.update_atom_cache(atoms) ewmh.set_supported(atom.atom_cache) #this is a list of the events that we don't want/need to filter by window. #Some such as MapRequest and ConfigureRequest we usually don't have a reference #for the window yet self.no_window_events = [ xproto.MappingNotifyEvent, xproto.MapRequestEvent, xproto.ConfigureRequestEvent ] # set substructure redirect on the root window. eventmask = [ xproto.EventMask.SubstructureRedirect | xproto.EventMask.SubstructureNotify ] err = self.conn.core.ChangeWindowAttributesChecked( self.root.win, xproto.CW.EventMask, eventmask) try: err.check() except xproto.BadAccess: print "We can't grab window manager status!, is there something else running?" raise OtherWindowManagerRunning self.conn.core.ChangeWindowAttributesChecked(self.root.win, xproto.CW.Cursor, [self.default_cursor]) self.do_workspaces(self.screen) self.scan_windows() self.logger.start()
def __init__ (self, conn) : self.conn = conn setup = self.conn.get_setup() self.current_workspace = None self.screen = Screen(self.conn, setup.roots[0], self) self.root = self.screen.root self.win_store = WindowStore(self.conn, self, []) self.swap_win = None self.swaps = 0 self.default_cursor= cursor.create_font_cursor(cursor.FontCursor.LeftPtr) self.move_cursor = cursor.create_font_cursor(cursor.FontCursor.Fleur) self.workspaces = [] self.current_workspace_num = 1 self.current_name = 'Desktop' self.current_win = None self.logger = logger.DzenLogger(self) #Proclaim to all just what we support atoms = ["_NET_WM_STRUT_PARTIAL", "_NET_WM_STATE_FULLSCREEN", "_NET_NUMBER_OF_DESKTOPS", "_NET_CURRENT_DESKTOP", "_NET_ACTIVE_WINDOW"] atom.update_atom_cache(atoms) ewmh.set_supported(atom.atom_cache) #this is a list of the events that we don't want/need to filter by window. #Some such as MapRequest and ConfigureRequest we usually don't have a reference #for the window yet self.no_window_events = [xproto.MappingNotifyEvent, xproto.MapRequestEvent, xproto.ConfigureRequestEvent] # set substructure redirect on the root window. eventmask = [xproto.EventMask.SubstructureRedirect | xproto.EventMask.SubstructureNotify] err = self.conn.core.ChangeWindowAttributesChecked(self.root.win, xproto.CW.EventMask, eventmask) try: err.check() except xproto.BadAccess: print "We can't grab window manager status!, is there something else running?" raise OtherWindowManagerRunning self.conn.core.ChangeWindowAttributesChecked(self.root.win, xproto.CW.Cursor, [self.default_cursor]) self.do_workspaces(self.screen) self.scan_windows() self.logger.start()
from xcb.xproto import ConfigWindow as cw import xcb.xproto as xproto from xpybutil import ewmh, icccm, util, event import atom atoms = ["_NET_WM_STATE_FULLSCREEN" , "WM_PROTOCOLS", "WM_TAKE_FOCUS", "WM_DELETE_WINDOW","_NET_WM_WINDOW_TYPE_DOCK", "_NET_WM_STATE_STICKY"] atom.update_atom_cache(atoms) class Window: def __init__(self, window, conn, wm): #The XID for our window, our connection to the #Xserver, and our reference to the Manager object self.win = window self.conn = conn self.wm = wm self.workspace = self.wm.current_workspace #these are set later, and I #haven't had a problem with it yet. self.x = 0 self.y = 0 self.w =0 self.h = 0 #do we have a strut? strut = self.get_wm_strut_partial() if strut: self.strut = strut else: self.strut = None #are we a fullscreen window ?
from xcb.xproto import ConfigWindow as cw import xcb.xproto as xproto from xpybutil import ewmh, icccm, util, event import atom atoms = [ "_NET_WM_STATE_FULLSCREEN", "WM_PROTOCOLS", "WM_TAKE_FOCUS", "WM_DELETE_WINDOW", "_NET_WM_WINDOW_TYPE_DOCK", "_NET_WM_STATE_STICKY" ] atom.update_atom_cache(atoms) class Window: def __init__(self, window, conn, wm): #The XID for our window, our connection to the #Xserver, and our reference to the Manager object self.win = window self.conn = conn self.wm = wm self.workspace = self.wm.current_workspace #these are set later, and I #haven't had a problem with it yet. self.x = 0 self.y = 0 self.w = 0 self.h = 0 #do we have a strut? strut = self.get_wm_strut_partial() if strut: self.strut = strut