def switcher_focus(name: str): """Focus a new application by name""" for app in ui.apps(): # print(f"--------- app.name:{app.name} app.bundler:{app.bundle}") if name in app.name and not app.background: app.focus() break
def switcher_focus_app(app: ui.App): """Focus application and wait until switch is made""" app.focus() t1 = time.monotonic() while ui.active_app() != app: if time.monotonic() - t1 > 1: raise RuntimeError(f"Can't focus app: {app.name}") actions.sleep(0.1)
def switcher_focus(name: str): """Focus a new application by name""" for app in ui.apps(): #print("app.name:" + app.name) #print("app.bundler: " + app.bundle) if app.name == name and not app.background: app.focus() break
def focus(name: str): """Focus a new application by name""" full = ctx.lists['self.running'].get(name) if not full: return for app in ui.apps(): if app.name == full and not app.background: app.focus() break
def switch_app(m): name = str(m._words[1]) full = apps.get(name) if not full: return for app in ui.apps(): if app.name == full: app.focus() # TODO: replace sleep with a check to see when it is in foreground time.sleep(0.25) break
def switch_app(m): name = str(m['switcher.running'][0]) full = running.get(name) if not full: return for app in ui.apps(): if app.name == full: app.focus() # TODO: replace sleep with a check to see when it is in foreground time.sleep(0.25) break
def switcher_focus(name: str): """Focus a new application by name""" app = actions.self.get_running_app(name) app.focus() # Hacky solution to do this reliably on Mac. timeout = 5 t1 = time.monotonic() if talon.app.platform == "mac": while ui.active_app() != app and time.monotonic() - t1 < timeout: time.sleep(0.1)