commit 22bd3805672a715538cafa19ce2e9f0cb6df506b Author: Knut Ahlers Date: Sun Sep 22 13:55:02 2019 +0200 Initial version diff --git a/images/icon.svg b/images/icon.svg new file mode 100644 index 0000000..a2bb6bd --- /dev/null +++ b/images/icon.svg @@ -0,0 +1,78 @@ + + blank keyboard keys + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xmlJakub Steinerhttp://jimmac.musichall.czCharacter Mapkeymapcharacteraccessory + + Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..54eeec5 --- /dev/null +++ b/main.py @@ -0,0 +1,42 @@ +from ulauncher.api.client.Extension import Extension +from ulauncher.api.client.EventListener import EventListener +from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent +from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem +from ulauncher.api.shared.action.RenderResultListAction import RenderResultListAction +from ulauncher.api.shared.action.HideWindowAction import HideWindowAction +from ulauncher.api.shared.action.ExtensionCustomAction import ExtensionCustomAction + +import subprocess + + +class AutoType(Extension): + + def __init__(self): + super(AutoType, self).__init__() + self.subscribe(KeywordQueryEvent, KeywordQueryEventListener()) + self.subscribe(ItemEnterEvent, AutoTypeExecute()) + + +class KeywordQueryEventListener(EventListener): + + def on_event(self, event, extension): + items = [] + items.append(ExtensionResultItem(icon='images/icon.svg', + name='Auto-Type text...', + description='Send text to foremost window using xdotool', + on_enter=ExtensionCustomAction({ + "query": event.get_argument(), + }, keep_app_open=False))) + + return RenderResultListAction(items) + + +class AutoTypeExecute(EventListener): + + def on_event(self, event, extension): + data = event.get_data() + subprocess.check_call(['xdotool', 'type', data['query']]) + + +if __name__ == '__main__': + AutoType().run() diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..b3ebcc8 --- /dev/null +++ b/manifest.json @@ -0,0 +1,16 @@ +{ + "required_api_version": "^2.0.0", + "name": "Auto-Type", + "description": "Automatically type stuff using xdotool when you're not allowed to paste", + "developer_name": "Knut Ahlers", + "icon": "icon/icon.svg", + "preferences": [ + { + "id": "autotype_kw", + "type": "keyword", + "name": "AutoType", + "description": "Auto-Type using xdotool", + "default_value": "at" + } + ] +} diff --git a/versions.json b/versions.json new file mode 100644 index 0000000..e7ff41c --- /dev/null +++ b/versions.json @@ -0,0 +1,6 @@ +[ + { + "required_api_version": "^2.0.0", + "commit": "master" + } +]