def focus(self): client = focus.focus_workspace(self) if client: client.focus() else: state.root_focus() self.focused()
def fallback(): def fallbackable(c): return (c.mapped and (c.workspace is None or workspace.current() == c.workspace)) stck = [client for client in get_stack() if fallbackable(client)] # This is *really* important. On occasion, it seems that focus can stay # with a destroyed window. If this happens to be the last window, and # there is nothing left in the focus stack, we *must* fall back to the # root! if not stck: state.root_focus() else: client = stck[-1] # If the window isn't alive, pop the stack until we get a good window if client.is_alive(): client.stack_raise() client.focus() else: remove(client) fallback()
def activate(self): state.root_focus()
events.register_callback(xproto.MappingNotifyEvent, root.cb_MappingNotifyEvent, state.root) events.register_callback(xproto.MapRequestEvent, client.cb_MapRequestEvent, state.root) events.register_callback(xproto.FocusInEvent, client.cb_FocusInEvent, state.root) events.register_callback(xproto.FocusOutEvent, client.cb_FocusOutEvent, state.root) events.register_callback(xproto.ConfigureRequestEvent, window.cb_ConfigureRequestEvent, state.root) events.register_callback(xproto.MotionNotifyEvent, grab.drag_do, state.pyndow, None, None, None) events.register_callback(xproto.ButtonReleaseEvent, grab.drag_end, state.pyndow, None, None, None) state.root_focus() while True: event.read(state.conn, block=True) for e in event.queue(): events.dispatch(e) events.run_latent() state.conn.flush() if state.die: break misc.spawn('killall Xephyr')