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()
from xdo import Xdo from time import sleep from loremipsum import get_sentences from random import randint xdo = Xdo() sleep(5) win_id = xdo.get_focused_window() while True: texts = get_sentences(randint(1,5)) speed = randint(50000, 1000000) for text in texts: xdo.enter_text_window(win_id, text, speed) xdo.send_keysequence_window(win_id, "Return")