async def term(editor, args): command = args.command if command: command += "\n" window_name = r"^Tilix:".encode("utf-8") xdo = Xdo() editor_window = xdo.get_active_window() windows = xdo.search_windows(window_name, only_visible=True) if not windows: return error("Tilix window not found") term = windows[0] xdo.focus_window(term) if command: xdo.enter_text_window(term, command.encode("utf-8")) xdo.focus_window(editor_window) else: xdo.raise_window(term) return result()
return "" if args.version: print("{} v{}".format(progname, version)) exit() if not (filenames or filepat or xfilepat): argparser.print_help() exit() print("(!) select window to send keypress events ...") targetWin = xdo.select_window_with_click() if targetWin: winname = getWindowName(targetWin) print("selected window: {}".format(winname)) for changes in watch("."): winname = getWindowName(targetWin) if winpat and not re.match(winpat, winname): continue reload = any([included(e[1]) for e in changes]) time.sleep(args.delay) if reload: curWin = xdo.get_active_window() xdo.focus_window(targetWin) xdo.send_keysequence_window(targetWin, key.encode("utf-8")) xdo.focus_window(curWin) print("sending {} to {}".format(key, targetWin))