To launch a non-Steam game using Steam, you can create a custom script that adds the game to your Steam library and modifies the launch options. Here's a Python script that you can use as a starting point:
import os
# Set your Steam library path and the path to your non-Steam game's executable
steam_library_path = "path/to/your/steam/library"
non_steam_game_exe = "path/to/your/non/steam/game/executable"
# Create a new folder in your Steam library for the non-Steam game
os.makedirs(os.path.join(steam_library_path, "non-steam game"), exist_ok=True)
# Copy the non-Steam game's executable to the new folder
shutil.copy(non_steam_game_exe, os.path.join(steam_library_path, "non-steam game", os.path.basename(non_steam_game_exe)))
# Create a new .desktop file for the non-Steam game in the new folder
desktop_file = os.path.join(steam_library_path, "non-steam game", "non-steam game.desktop")
with open(desktop_file, "w") as f:
f.write("""
[Desktop Entry]
Type=Application
Name=Non-Steam Game
Exec=path/to/your/non/steam/game/executable
""")
# Add the non-Steam game to your Steam library
os.system(f"steam://addlibrarygame {steam_library_path}/non-steam game/{os.path.basename(non_steam_game_exe)}")
# Set the launch options for the non-Steam game
os.system(f"steam://setlaunchoptions {steam_library_path}/non-steam game/{os.path.basename(non_steam_game_exe)} +your_custom_launch_options")
print("Non-Steam game added to Steam library and launch options set successfully.")
Replace path/to/your/steam/library and path/to/your/non/steam/game/executable with the appropriate paths for your system.
This script creates a new folder in your Steam library for the non-Steam game, copies the game's executable to the new folder, creates a new .desktop file for the game, adds the game to your Steam library, and sets the launch options for the game using the steam://setlaunchoptions command.
Please note that this script assumes you have Python and the shutil library installed on your system. You may need to adjust the paths and launch options according to your specific setup.