generated from SteamDeckHomebrew/decky-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
30 lines (24 loc) · 854 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pathlib
import subprocess
import asyncio
import os
HOME_DIR = str(pathlib.Path(os.getcwd()).parent.parent.resolve())
PARENT_DIR = str(pathlib.Path(__file__).parent.resolve())
LOG_LOCATION = "/tmp/controller-tools.py.log"
import logging
logging.basicConfig(
filename = LOG_LOCATION,
format = '%(asctime)s %(levelname)s %(message)s',
filemode = 'w',
force = True)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logging.info(f"ControllerTools main.py https://github.com/alphamercury/ControllerTools")
class Plugin:
backend_proc = None
# Asyncio-compatible long-running code, executed in a task when the plugin is loaded
async def _main(self):
# startup with my_env
self.backend_proc = subprocess.Popen([PARENT_DIR + "/bin/backend"])
while True:
await asyncio.sleep(1)