def set_border_color(): """ Get active window and set border color if the _QUBES_LABEL value has changed """ global current_qlabel qlabel = 0 activewin = ewmh.get_active_window().reply() if not activewin: return try: prop = util.PropertyCookie(util.get_property(activewin, '_QUBES_LABEL')).reply() except: return if prop is not None: qlabel = ord(prop) if qlabel != current_qlabel: color = COLORS.get(qlabel) call(["bspc", "config", "focused_border_color", color]) current_qlabel = qlabel xpybutil.conn.flush()
def set_border_color(): """ Get active window and set border color if the _QUBES_LABEL value has changed """ global current_qlabel qlabel = 0 activewin = ewmh.get_active_window().reply() if not activewin: return try: prop = util.PropertyCookie(util.get_property( activewin, '_QUBES_LABEL')).reply() except: return if prop is not None: qlabel = ord(prop) if qlabel != current_qlabel: color = COLORS.get(qlabel) call(["bspc", "config", "focused_border_color", color]) current_qlabel = qlabel xpybutil.conn.flush()
def consume_event(event): atom_name = CONNECTION.core.\ GetAtomName(event.atom)\ .reply()\ .name\ .to_string() if '_NET_ACTIVE_WINDOW' == atom_name: ROFI_BUS.UpdateActiveWindow(get_active_window().reply())
def check_event(self, event): print(event) atom_name = self.connection.core.\ GetAtomName(event.atom)\ .reply()\ .name\ .to_string() if '_NET_ACTIVE_WINDOW' == atom_name: self.listener.update_active_window(get_active_window().reply())
def update_window_opacity(): activewin = ewmh.get_active_window().reply() if not activewin: return for client in clients: ewmh.set_wm_window_opacity(util.get_parent_window(client), 1 if client == activewin else opacity) xpybutil.conn.flush()
def update_window_opacity(): activewin = ewmh.get_active_window().reply() if not activewin: return for client in clients: ewmh.set_wm_window_opacity(util.get_parent_window(client), 1 if client == activewin else opacity) xpybutil.conn.flush()
def prompt_set_activewin_desktop(): activewin = ewmh.get_active_window().reply() def fun(name): names = ewmh.get_desktop_names().reply() if name not in names: names.append(name) ewmh.set_desktop_names_checked(names).check() num_desks = ewmh.get_number_of_desktops().reply() ewmh.request_number_of_desktops_checked(num_desks + 1).check() ewmh.request_wm_desktop_checked(activewin, names.index(name), 2).check() prompt.desktops(fun)
def prompt_set_activewin_desktop(): activewin = ewmh.get_active_window().reply() def fun(name): names = ewmh.get_desktop_names().reply() if name not in names: names.append(name) ewmh.set_desktop_names_checked(names).check() num_desks = ewmh.get_number_of_desktops().reply() ewmh.request_number_of_desktops_checked(num_desks + 1).check() ewmh.request_wm_desktop_checked(activewin, names.index(name), 2).check() prompt.desktops(fun)
def active_window_handler() : global active_window # 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'
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(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_prop_change(widget, e): global activewin, desk_names, desk_num, desktop, stacking, visibles if e.atom == '_NET_DESKTOP_GEOMETRY': root_geom = ewmh.get_desktop_geometry().reply() update_monitor_area() elif e.atom == '_NET_ACTIVE_WINDOW': activewin = ewmh.get_active_window().reply() elif e.atom == '_NET_CURRENT_DESKTOP': desktop = ewmh.get_current_desktop().reply() elif e.atom == '_NET_CLIENT_LIST_STACKING': stacking = ewmh.get_client_list_stacking().reply() elif e.atom == '_NET_VISIBLE_DESKTOPS': visibles = ewmh.get_visible_desktops().reply() elif e.atom in ('_NET_DESKTOP_NAMES', '_NET_NUMBER_OF_DESKTOPS'): desk_num = ewmh.get_number_of_desktops().reply() desk_names = ewmh.get_desktop_names().reply() # This works around what I think is weird behavior in Openbox. # Sometimes Openbox will "fix" the desktop names... please don't! if len(desk_names) > desk_num: names = desk_names[0:desk_num] ewmh.set_desktop_names_checked(names).check() desk_names = ewmh.get_desktop_names().reply()
def cb_prop_change(widget, e): global activewin, desk_names, desk_num, desktop, stacking, visibles if e.atom == '_NET_DESKTOP_GEOMETRY': root_geom = ewmh.get_desktop_geometry().reply() update_monitor_area() elif e.atom == '_NET_ACTIVE_WINDOW': activewin = ewmh.get_active_window().reply() elif e.atom == '_NET_CURRENT_DESKTOP': desktop = ewmh.get_current_desktop().reply() elif e.atom == '_NET_CLIENT_LIST_STACKING': stacking = ewmh.get_client_list_stacking().reply() elif e.atom == '_NET_VISIBLE_DESKTOPS': visibles = ewmh.get_visible_desktops().reply() elif e.atom in ('_NET_DESKTOP_NAMES', '_NET_NUMBER_OF_DESKTOPS'): desk_num = ewmh.get_number_of_desktops().reply() desk_names = ewmh.get_desktop_names().reply() # This works around what I think is weird behavior in Openbox. # Sometimes Openbox will "fix" the desktop names... please don't! if len(desk_names) > desk_num: names = desk_names[0:desk_num] ewmh.set_desktop_names_checked(names).check() desk_names = ewmh.get_desktop_names().reply()
def set_activewin_desktop(i_or_name): awin = ewmh.get_active_window().reply() set_win_desktop(i_or_name, awin)
def get_active_window(self): return ewmh.get_active_window().reply()
def set_activewin_desktop(i_or_name): awin = ewmh.get_active_window().reply() set_win_desktop(i_or_name, awin)
def do_mark_window(letter): awin = ewmh.get_active_window().reply() if awin is not None: marked[letter] = awin
def getActiveWin(): return ewmh.get_active_window().reply()
if wm.lower() == 'openbox': utilwm = window.WindowManagers.Openbox elif wm.lower() == 'kwin': utilwm = window.WindowManagers.KWin print '%s window manager is running...' % wm sys.stdout.flush() if not _wmrunning: time.sleep(1) root_geom = ewmh.get_desktop_geometry().reply() monitors = xinerama.get_monitors() phys_monitors = xinerama.get_physical_mapping(monitors) desk_num = ewmh.get_number_of_desktops().reply() activewin = ewmh.get_active_window().reply() desktop = ewmh.get_current_desktop().reply() visibles = ewmh.get_visible_desktops().reply() or [desktop] stacking = ewmh.get_client_list_stacking().reply() workarea = [] def quit(): print 'Exiting...' import tile for tiler in tile.tilers: tile.get_active_tiler(tiler)[0].untile() sys.exit(0) def update_workarea(): ''' We update the current workarea either by autodetecting struts, or by
def get_focused_window() -> Optional[Window]: window_id = get_active_window().reply() if window_id is not None: return Window(window_id) else: return None
import xpybutil.ewmh as ewmh import time count = 0 while True: # XCB allows async communication with the X server. return values are cookies cookie = ewmh.get_active_window() # blocking wait for X server reply window = cookie.reply() #print window count += 1 if count % 100 == 0 : print window, count time.sleep(0.01)
def do_mark_window(letter): awin = ewmh.get_active_window().reply() if awin is not None: marked[letter] = awin