def update_NET_DESKTOP_GEOMETRY(force=False): global properties, xinerama old_geom = properties["_NET_DESKTOP_GEOMETRY"] old_xinerama = xinerama time.sleep(1) properties["_NET_DESKTOP_GEOMETRY"] = ptxcb.XROOT.get_desktop_geometry() xinerama = ptxcb.connection.xinerama_get_screens() if old_xinerama != xinerama or force: if not force and len(old_xinerama) == len(xinerama): for mon in Workspace.iter_all_monitors(): mid = mon.id mon.refresh_bounds( xinerama[mid]["x"], xinerama[mid]["y"], xinerama[mid]["width"], xinerama[mid]["height"] ) mon.calculate_workarea() else: for mon in Workspace.iter_all_monitors(): for tiler in mon.tilers: tiler.destroy() for wid in Window.WINDOWS.keys(): Window.remove(wid) for wsid in Workspace.WORKSPACES.keys(): Monitor.remove(wsid) Workspace.remove(wsid) reset_properties() load_properties()
def update_NET_CLIENT_LIST(): global properties old = properties["_NET_CLIENT_LIST"] new = set(ptxcb.XROOT.get_window_ids()) properties["_NET_CLIENT_LIST"] = new if old != new: for wid in new.difference(old): Window.add(wid) for wid in old.difference(new): Window.remove(wid) # This might be redundant, but it's important to know # the new active window if the old one was destroyed # as soon as possible update_NET_ACTIVE_WINDOW()