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()
pyndow = conn.generate_id() core.CreateWindow(rsetup.root_depth, pyndow, root, -1000, -1000, 1, 1, 0, xproto.WindowClass.InputOutput, rsetup.root_visual, xproto.CW.EventMask | xproto.CW.OverrideRedirect, [xproto.EventMask.PropertyChange, 1]) core.MapWindow(pyndow) grab_pointer = False grab_keyboard = False __kbmap = keysym.get_keyboard_mapping(conn) __keystomods = keysym.get_keys_to_mods(conn) FC = cursor.FontCursor cursors = { 'LeftPtr': cursor.create_font_cursor(conn, FC.LeftPtr), 'Fleur': cursor.create_font_cursor(conn, FC.Fleur), 'Watch': cursor.create_font_cursor(conn, FC.Watch), 'TopSide': cursor.create_font_cursor(conn, FC.TopSide), 'TopRightCorner': cursor.create_font_cursor(conn, FC.TopRightCorner), 'RightSide': cursor.create_font_cursor(conn, FC.RightSide), 'BottomRightCorner': cursor.create_font_cursor(conn, FC.BottomRightCorner), 'BottomSide': cursor.create_font_cursor(conn, FC.BottomSide), 'BottomLeftCorner': cursor.create_font_cursor(conn, FC.BottomLeftCorner), 'LeftSide': cursor.create_font_cursor(conn, FC.LeftSide), 'TopLeftCorner': cursor.create_font_cursor(conn, FC.TopLeftCorner) } # The set of all windows being managed. windows = OrderedDict()