예제 #1
0
def mainloop():
    wm = Manager(Xconn)
    wm.register_handlers()
    bind_launcher_keys()
    #Should move these to Manager.register_handlers()
    keybind.bind_global_key('KeyRelease', 'Mod4-x', quit)
    try:
        while True:
            if exit:
                break
            event.read()
            for e in event.queue():
                #print e
                w = None
                if wm.no_window(e):
                    w = None
                elif hasattr(e, 'window'):
                    w = e.window
                elif hasattr(e, 'event'):
                    w = e.event
                elif hasattr(e, 'requestor'):
                    w = e.requestor
                key = (e.__class__, w)
                for cb in event.__callbacks.get(key, []):
                    cb(e)
                wm.conn.flush()
    except xcb.Exception:
        traceback.print_exc()
        sys.exit(1)
예제 #2
0
def mainloop():
    wm = Manager(Xconn)
    wm.register_handlers()
    bind_launcher_keys()
    #Should move these to Manager.register_handlers()
    keybind.bind_global_key('KeyRelease', 'Mod4-x', quit)
    try:
        while True:
            if exit:
                break
            event.read()
            for e in event.queue():
                #print e
                w = None
                if wm.no_window(e):
                    w = None
                elif hasattr(e, 'window'):
                    w = e.window
                elif hasattr(e, 'event'):
                    w = e.event
                elif hasattr(e, 'requestor'):
                    w = e.requestor
                key = (e.__class__, w)
                for cb in event.__callbacks.get(key, []):
                    cb(e)
                wm.conn.flush()
    except xcb.Exception:
        traceback.print_exc()
        sys.exit(1)
예제 #3
0
파일: client.py 프로젝트: sahwar/pyndow
    def is_alive(self):
        """
        A useful auxiliary method to determine if a client is alive and can
        still be used. This is achieved at peeking to see if an unmap event
        has been queued up.
        """
        state.sync()

        event.read(state.conn)
        ignore = self.__unmap_ignore

        for e in event.peek():
            if (isinstance(e, xcb.xproto.UnmapNotifyEvent)
                    and e.window == self.win.id):
                if not ignore:
                    return False

                ignore = max(ignore - 1, 0)

        return True
예제 #4
0
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')
                out_hidden.append(markup['hidden'] % names[d])
            else:
                out_hidden.append(markup['hidden_empty'] % names[d])
 
    print '[%s] %s' % (' '.join(out_visible), ' '.join(out_hidden))
 
    sys.stdout.flush()
 
do_output(visibles, currentdesk, names, deskcnt)
 
when_output = set(['_NET_CURRENT_DESKTOP', '_NET_VISIBLE_DESKTOPS',
                  '_NET_DESKTOP_NAMES', '_NET_NUMBER_DESKTOPS'])
 
try:
    while True:
        event.read(block=True)
        for e in event.queue():
            if not isinstance(e, xcb.xproto.PropertyNotifyEvent):
                continue
 
            aname = util.get_atom_name(e.atom)
            if aname == '_NET_CURRENT_DESKTOP':
                currentdesk = ewmh.get_current_desktop().reply()
            elif aname == '_NET_VISIBLE_DESKTOPS':
                visibles = ewmh.get_visible_desktops().reply()
            elif aname == '_NET_DESKTOP_NAMES':
                names = ewmh.get_desktop_names().reply()
            elif aname == '_NET_NUMBER_OF_DESKTOPS':
                deskcnt = ewmh.get_number_of_desktops().reply()
 
            if aname in when_output: