def copy_paste_characters(self, characters: str, active_window: str, typer: Typer) -> None: old_clipboard_content = run(args=['xclip', '-o', '-selection', 'clipboard'], capture_output=True).stdout old_primary_content = run(args=['xclip', '-o', '-selection', 'primary'], capture_output=True).stdout run(args=['xclip', '-i', '-selection', 'clipboard'], input=characters, encoding='utf-8') run(args=['xclip', '-i', '-selection', 'primary'], input=characters, encoding='utf-8') typer.insert_from_clipboard(active_window) run(args=['xclip', '-i', '-selection', 'clipboard'], input=old_clipboard_content) run(args=['xclip', '-i', '-selection', 'primary'], input=old_primary_content)
def __init__(self) -> None: self.args = self.parse_arguments() self.selector = Selector.best_option(self.args.selector) self.typer = Typer.best_option(self.args.typer) self.clipboarder = Clipboarder.best_option(self.args.clipboarder) self.active_window = self.typer.get_active_window() self.display_recents_bar = self.args.display_recents == 'bar'
def __init__(self) -> None: self.args = self.parse_arguments() self.typer = Typer.best_option(self.args.typer) self.clipboarder = Clipboarder.best_option(self.args.clipboarder) self.active_window = self.typer.get_active_window() returncode, stdout = self.open_main_rofi_window() if returncode == 1: sys.exit() else: if 10 <= returncode <= 19: characters = self.load_recent_characters(self.args.max_recent)[returncode - 10].strip() else: self.choose_action_from_return_code(returncode) characters = self.process_chosen_characters(stdout.splitlines()) self.execute_action(characters)