Compare commits
No commits in common. "e33af718dc0ee4fcbc8aa4273b759a36731e45d4" and "8f0cb6cd3fe0e0123690ce9bd2c2835bf633699c" have entirely different histories.
e33af718dc
...
8f0cb6cd3f
@ -1,37 +1,21 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
try:
|
tmp = os.popen("lutris -ojl").read()
|
||||||
# Получаем список игр
|
games = json.loads(tmp)
|
||||||
result = subprocess.run(["lutris", "-ojl"], capture_output=True, text=True)
|
|
||||||
games = json.loads(result.stdout)
|
|
||||||
|
|
||||||
# Формируем список названий
|
gameslist = ""
|
||||||
game_names = [game["name"] for game in games]
|
concat = ""
|
||||||
games_list = "\n".join(game_names)
|
for item in games:
|
||||||
|
gameslist = gameslist + concat + item["name"]
|
||||||
|
concat = "\n"
|
||||||
|
|
||||||
# Выбор игры через wofi
|
tmp = subprocess.getoutput("echo \"" + gameslist + "\" | wofi -n -d -p \"Select Game:\"")
|
||||||
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()
|
|
||||||
|
|
||||||
if not selected_game:
|
for item in games:
|
||||||
sys.exit(0)
|
if item["name"] == tmp:
|
||||||
|
subprocess.Popen(["lutris","lutris:rungameid/" + str(item["id"])])
|
||||||
# Запускаем выбранную игру
|
break
|
||||||
for game in games:
|
|
||||||
if game["name"] == selected_game:
|
|
||||||
subprocess.Popen(["lutris", f"lutris:rungameid/{game['id']}"])
|
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error: {e}", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user