By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 __init__.py

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