2 Commits

Author SHA1 Message Date
3f0d259bf0 fix(toggleGame): enable PortProton game launch by removing premature return and setting proper process tracking
All checks were successful
Code and build check / Check code (push) Successful in 2m9s
Code and build check / Build with uv (push) Successful in 57s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-25 10:56:46 +05:00
1230d85fe6 fix(egs): fix invalid .desktop format caused by indentation
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-25 10:38:57 +05:00
2 changed files with 34 additions and 38 deletions

View File

@@ -395,15 +395,16 @@ class ContextMenuManager:
os.makedirs(egs_desktop_dir, exist_ok=True)
desktop_path = self._get_egs_desktop_path(game_name)
comment = _('Launch game "{name}" with PortProton').format(name=game_name)
desktop_entry = f"""[Desktop Entry]
Type=Application
Name={game_name}
Comment={comment}
Terminal=false
StartupNotify=true
Exec="{self.legendary_path}" launch {app_name} --no-wine --wrapper "env START_FROM_STEAM=1 {wrapper}"
Icon={icon_path}
Categories=Game
desktop_entry =f"""\
[Desktop Entry]
Name={game_name}
Comment={comment}
Exec="{self.legendary_path}" launch {app_name} --no-wine --wrapper "env START_FROM_STEAM=1 {wrapper}"
Terminal=false
Type=Application
Categories=Game;
StartupNotify=true
Icon={icon_path}
"""
try:
with open(desktop_path, "w", encoding="utf-8") as f:

View File

@@ -2072,22 +2072,16 @@ class MainWindow(QMainWindow):
exe_name = os.path.splitext(current_exe)[0]
env_vars = os.environ.copy()
# Delay disabling gamepad handling to allow rumble to complete
if hasattr(self, 'input_manager'):
QTimer.singleShot(200, self.input_manager.disable_gamepad_handling)
if entry_exec_split[0] == "env" and len(entry_exec_split) > 1 and 'data/scripts/start.sh' in entry_exec_split[1]:
env_vars['START_FROM_STEAM'] = '1'
elif entry_exec_split[0] == "flatpak":
env_vars['START_FROM_STEAM'] = '1'
return
# Delay disabling gamepad handling to allow rumble to complete
if hasattr(self, 'input_manager'):
QTimer.singleShot(200, self.input_manager.disable_gamepad_handling)
# Запускаем игру
self.current_running_button = update_button
self.target_exe = current_exe
exe_name = os.path.splitext(current_exe)[0]
env_vars = os.environ.copy()
env_vars['START_FROM_STEAM'] = '1'
try:
process = subprocess.Popen(entry_exec_split, env=env_vars, shell=False, preexec_fn=os.setsid)
self.game_processes.append(process)
@@ -2108,6 +2102,7 @@ class MainWindow(QMainWindow):
logger.error(f"Failed to launch game {exe_name}: {e}")
QMessageBox.warning(self, _("Error"), _("Failed to launch game: {0}").format(str(e)))
def closeEvent(self, event):
"""Завершает все дочерние процессы и сохраняет настройки при закрытии окна."""
for proc in self.game_processes: