__init__.py
Python script, ASCII text executable
1import os 2import subprocess 3 4class Provider: 5def __init__(self, name, icon, description, config): 6self.name = name 7self.icon = icon 8self.description = description 9self.config = config 10 11async def search(self, query): 12return 13yield 14 15 16def launch_command(command, shell=False): 17if os.getenv("FLATPAK_SANDBOX_DIR"): 18if shell: 19command = ["sh", "-c", command] 20subprocess.run(["flatpak-spawn", "--host"] + command) 21else: 22if shell: 23subprocess.run(command, shell=True) 24else: 25subprocess.run(command) 26 27 28def xdg_open(path): 29launch_command(["xdg-open", path]) 30 31 32def run_desktop_entry(filename): 33launch_command(["gio", "launch", filename]) 34