Compare commits

...

2 Commits

Author SHA1 Message Date
e33af718dc Merge remote-tracking branch 'origin/master' 2025-07-19 13:56:01 +07:00
6579dac3a4 fix menugame for lutris 2025-07-19 13:45:02 +07:00

View File

@ -1,21 +1,37 @@
#!/usr/bin/env python #!/usr/bin/env python3
import json import json
import os import os
import subprocess import subprocess
import sys
tmp = os.popen("lutris -ojl").read() try:
games = json.loads(tmp) # Получаем список игр
result = subprocess.run(["lutris", "-ojl"], capture_output=True, text=True)
games = json.loads(result.stdout)
gameslist = "" # Формируем список названий
concat = "" game_names = [game["name"] for game in games]
for item in games: games_list = "\n".join(game_names)
gameslist = gameslist + concat + item["name"]
concat = "\n"
tmp = subprocess.getoutput("echo \"" + gameslist + "\" | wofi -n -d -p \"Select Game:\"") # Выбор игры через wofi
wofi_process = subprocess.Popen(
["wofi", "-n", "-d", "-p", "Select Game:"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
text=True
)
selected_game, _ = wofi_process.communicate(input=games_list)
selected_game = selected_game.strip()
for item in games: if not selected_game:
if item["name"] == tmp: sys.exit(0)
subprocess.Popen(["lutris","lutris:rungameid/" + str(item["id"])])
# Запускаем выбранную игру
for game in games:
if game["name"] == selected_game:
subprocess.Popen(["lutris", f"lutris:rungameid/{game['id']}"])
break break
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)