def is_fullscreen(self) -> bool: wm_states = get_wm_state(self.id).reply() # wm_states might be null in some WMs - #29 if wm_states: for wm_state in wm_states: if get_atom_name(wm_state) == "_NET_WM_STATE_FULLSCREEN": return True return False
def cb_property_notify(e): global clients aname = util.get_atom_name(e.atom) if aname == '_NET_ACTIVE_WINDOW': update_window_opacity(); elif aname == '_NET_CLIENT_LIST': clients = filter(client_is_normal, ewmh.get_client_list().reply())
def cb_property_notify(e): debug("Entering cb_property_notify") # import pdb; pdb.set_trace() aname = util.get_atom_name(e.atom) debug(str(aname)) if aname == "_NET_CLIENT_LIST_STACKING": cu = update_clients() debug(str("Clients updated: %s" % cu))
def cb_property_notify(e): """ Event callback for property change. Checks that the _NET_ACTIVE_WINDOW atom is the property that has changed. Then set border color """ aname = util.get_atom_name(e.atom) if aname == '_NET_ACTIVE_WINDOW': set_border_color()
def cb_property_notify(e): global clients aname = util.get_atom_name(e.atom) if aname == '_NET_ACTIVE_WINDOW': update_window_opacity() elif aname == '_NET_CLIENT_LIST': clients = filter(client_is_normal, ewmh.get_client_list().reply())
def _handle_property_change(self, event: Event) -> None: """Handle a property change on a watched window.""" atom_name = get_atom_name(event.atom) if atom_name == "_NET_ACTIVE_WINDOW": focused_window = get_focused_window() if focused_window is not None: logging.debug(f"Focus shifted to {focused_window.id}") self.queue_window(focused_window, WMEventType.FOCUS_SHIFT) elif atom_name == "WM_NAME" and event.window == self.message_window.id: # Received kill signal from server -> terminate the thread self.keep_going = False
def track_client(c): assert c not in state.clients wstate = ewmh.get_wm_state(c).reply() for atom in wstate: aname = util.get_atom_name(atom) # For now, while I decide how to handle these guys if aname == '_NET_WM_STATE_STICKY': break if aname in ('_NET_WM_STATE_SHADED', '_NET_WM_STATE_SKIP_PAGER', '_NET_WM_STATE_HIDDEN'): break else: state.clients[c] = Client(c)
def cb_property_notify(e): aname = util.get_atom_name(e.atom) if aname == '_NET_NUMBER_OF_DESKTOPS': update_tilers() elif aname == '_NET_CURRENT_DESKTOP': if len(state.visibles) == 1: tiler, _ = get_active_tiler(state.desktop) if tiler.tiling: tiler.tile() elif aname == '_NET_VISIBLE_DESKTOPS': for d in state.visibles: tiler, _ = get_active_tiler(d) if tiler.tiling: tiler.tile()
def _handle_property_change(self, event): """Handle a property change on a watched window.""" atom_name = get_atom_name(event.atom) if atom_name == "_NET_ACTIVE_WINDOW": focused_window = get_active_window().reply() logging.info("Focus shifted to %s", focused_window) try: set_opacity(focused_window, flashfocus.ui.CONFIG['flash_opacity']) except: pass self.queue_window(focused_window, "focus_shift") elif atom_name == "WM_NAME" and event.window == self.message_window: # Received kill signal from server -> terminate the thread self.keep_going = False
def cb_property_notify(self, e): aname = util.get_atom_name(e.atom) try: if aname == '_NET_WM_DESKTOP': if should_ignore(self.wid): untrack_client(self.wid) return olddesk = self.desk self.desk = ewmh.get_wm_desktop(self.wid).reply() if self.desk is not None and self.desk != olddesk: tile.update_client_desktop(self, olddesk) else: self.desk = olddesk elif aname == '_NET_WM_STATE': if should_ignore(self.wid): untrack_client(self.wid) return except xcb.xproto.BadWindow: pass # S'ok...
def cb_property_notify(e): global activewin, desk_num, desktop, monitors, phys_monitors, root_geom, stacking, visibles, workarea aname = util.get_atom_name(e.atom) if aname == "_NET_DESKTOP_GEOMETRY": root_geom = ewmh.get_desktop_geometry().reply() monitors = xinerama.get_monitors() phys_monitors = xinerama.get_physical_mapping(monitors) elif aname == "_NET_ACTIVE_WINDOW": activewin = ewmh.get_active_window().reply() elif aname == "_NET_CURRENT_DESKTOP": desktop = ewmh.get_current_desktop().reply() if visibles is None or len(visibles) == 1: visibles = [desktop] elif aname == "_NET_VISIBLE_DESKTOPS": visibles = ewmh.get_visible_desktops().reply() elif aname == "_NET_NUMBER_OF_DESKTOPS": desk_num = ewmh.get_number_of_desktops().reply() elif aname == "_NET_CLIENT_LIST_STACKING": stacking = ewmh.get_client_list_stacking().reply() elif aname == "_NET_WORKAREA": update_workarea()
def cb_property_notify(e): global activewin, desk_num, desktop, monitors, phys_monitors, root_geom, \ stacking, visibles, workarea aname = util.get_atom_name(e.atom) if aname == '_NET_DESKTOP_GEOMETRY': root_geom = ewmh.get_desktop_geometry().reply() monitors = xinerama.get_monitors() phys_monitors = xinerama.get_physical_mapping(monitors) elif aname == '_NET_ACTIVE_WINDOW': activewin = ewmh.get_active_window().reply() elif aname == '_NET_CURRENT_DESKTOP': desktop = ewmh.get_current_desktop().reply() if visibles is None or len(visibles) == 1: visibles = [desktop] elif aname == '_NET_VISIBLE_DESKTOPS': visibles = ewmh.get_visible_desktops().reply() elif aname == '_NET_NUMBER_OF_DESKTOPS': desk_num = ewmh.get_number_of_desktops().reply() elif aname == '_NET_CLIENT_LIST_STACKING': stacking = ewmh.get_client_list_stacking().reply() elif aname == '_NET_WORKAREA': update_workarea()
def cb_property_notify(e): aname = util.get_atom_name(e.atom) if aname == '_NET_CLIENT_LIST_STACKING': update_clients()
def should_ignore(client): # Don't waste time on clients we'll never possibly tile if client in ignore: return True nm = ewmh.get_wm_name(client).reply() wm_class = icccm.get_wm_class(client).reply() if wm_class is not None: try: inst, cls = wm_class matchNames = set([inst.lower(), cls.lower()]) if matchNames.intersection(config.ignore): debug('Ignoring %s because it is in the ignore list' % nm) return True if hasattr(config, 'tile_only') and config.tile_only: if not matchNames.intersection(config.tile_only): debug('Ignoring %s because it is not in the tile_only ' 'list' % nm) return True except ValueError: pass if icccm.get_wm_transient_for(client).reply() is not None: debug('Ignoring %s because it is transient' % nm) ignore.append(client) return True wtype = ewmh.get_wm_window_type(client).reply() if wtype: for atom in wtype: aname = util.get_atom_name(atom) if aname in ('_NET_WM_WINDOW_TYPE_DESKTOP', '_NET_WM_WINDOW_TYPE_DOCK', '_NET_WM_WINDOW_TYPE_TOOLBAR', '_NET_WM_WINDOW_TYPE_MENU', '_NET_WM_WINDOW_TYPE_UTILITY', '_NET_WM_WINDOW_TYPE_SPLASH', '_NET_WM_WINDOW_TYPE_DIALOG', '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU', '_NET_WM_WINDOW_TYPE_POPUP_MENU', '_NET_WM_WINDOW_TYPE_TOOLTIP', '_NET_WM_WINDOW_TYPE_NOTIFICATION', '_NET_WM_WINDOW_TYPE_COMBO', '_NET_WM_WINDOW_TYPE_DND'): debug('Ignoring %s because it has type %s' % (nm, aname)) ignore.append(client) return True wstate = ewmh.get_wm_state(client).reply() if wstate is None: debug('Ignoring %s because it does not have a state' % nm) return True for atom in wstate: aname = util.get_atom_name(atom) # For now, while I decide how to handle these guys if aname == '_NET_WM_STATE_STICKY': debug('Ignoring %s because it is sticky and they are weird' % nm) return True if aname in ('_NET_WM_STATE_SHADED', '_NET_WM_STATE_HIDDEN', '_NET_WM_STATE_FULLSCREEN', '_NET_WM_STATE_MODAL'): debug('Ignoring %s because it has state %s' % (nm, aname)) return True d = ewmh.get_wm_desktop(client).reply() if d == 0xffffffff: debug('Ignoring %s because it\'s on all desktops' \ '(not implemented)' % nm) return True return False
def handleEvents(e): atom = util.get_atom_name(e.atom) if atom == '_NET_CURRENT_DESKTOP': sendEvent("desktops", "desktopChanged", getCurrentDesktop())
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: do_output(visibles, currentdesk, names, deskcnt) c.flush() except IOError, xcb.Exception: print >> sys.stderr, "X connection lost!"
# de-register all events (including 'PropertyChange' for name change notifications) # de-registering will fail if there is no active window: # upon startup, or when the active window changed because a window was closed try : window.listen(active_window, ) except : print 'failed to de-register events for active window' active_window = ewmh.get_active_window().reply() # register to listen for name changes on the active window try : window.listen(active_window, 'PropertyChange') # when the active window changes the title changes name_change_handler() except : print 'failed to register events for active window' window.listen(root, 'PropertyChange') while True: e = conn.wait_for_event() # SIGINT will be caught upon blocking call return if not isinstance(e, xcb.xproto.PropertyNotifyEvent): # print 'unexpected message type', e continue aname = util.get_atom_name(e.atom) if aname == '_NET_ACTIVE_WINDOW': active_window_handler() if aname == 'WM_NAME': name_change_handler() # else : # print 'ignoring', aname
def cb_PropertyNotifyEvent(self, e): prop = util.get_atom_name(state.conn, e.atom) if prop in ('_NET_WM_NAME', 'WM_NAME'): self.set_text(self.frame.client.win.wmname) self.render()
def should_ignore(client): debug("Entering should_ignore %s" % str(client)) # debug_object(clients) # debug("This client: %s" % str(client)) # Don't waste time on clients we'll never possibly tile if client in ignore: # debug("Ignoring client %s" % client) # debug("Ignore is:") # debug(ignore) return True nm = ewmh.get_wm_name(client).reply() wm_class = icccm.get_wm_class(client).reply() if wm_class is not None: try: inst, cls = wm_class matchNames = set([inst.lower(), cls.lower()]) if matchNames.intersection(config.ignore): debug("Ignoring %s because it is in the ignore list" % nm) return True if hasattr(config, "tile_only") and config.tile_only: if not matchNames.intersection(config.tile_only): debug("Ignoring %s because it is not in the tile_only " "list" % nm) debug("Ignoring client %s" % client) return True except ValueError: pass if icccm.get_wm_transient_for(client).reply() is not None: debug("Ignoring %s because it is transient" % nm) ignore.append(client) return True wtype = ewmh.get_wm_window_type(client).reply() if wtype: for atom in wtype: aname = util.get_atom_name(atom) if aname in ( "_NET_WM_WINDOW_TYPE_DESKTOP", "_NET_WM_WINDOW_TYPE_DOCK", "_NET_WM_WINDOW_TYPE_TOOLBAR", "_NET_WM_WINDOW_TYPE_MENU", "_NET_WM_WINDOW_TYPE_UTILITY", "_NET_WM_WINDOW_TYPE_SPLASH", "_NET_WM_WINDOW_TYPE_DIALOG", "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", "_NET_WM_WINDOW_TYPE_POPUP_MENU", "_NET_WM_WINDOW_TYPE_TOOLTIP", "_NET_WM_WINDOW_TYPE_NOTIFICATION", "_NET_WM_WINDOW_TYPE_COMBO", "_NET_WM_WINDOW_TYPE_DND", ): debug("Ignoring %s because it has type %s" % (nm, aname)) ignore.append(client) return True wstate = ewmh.get_wm_state(client).reply() if wstate is None: debug("Ignoring %s because it does not have a state" % nm) return True for atom in wstate: aname = util.get_atom_name(atom) # For now, while I decide how to handle these guys if aname == "_NET_WM_STATE_STICKY": debug("Ignoring %s because it is sticky and they are weird" % nm) return True if aname in ( "_NET_WM_STATE_SHADED", "_NET_WM_STATE_HIDDEN", "_NET_WM_STATE_FULLSCREEN", "_NET_WM_STATE_MODAL", ): debug("Ignoring %s because it has state %s" % (nm, aname)) return True d = ewmh.get_wm_desktop(client).reply() if d == 0xFFFFFFFF: debug("Ignoring %s because it's on all desktops" "(not implemented)" % nm) return True debug("Not ignoring client %s" % client) return False