From 012f8cbda2a158f135a575894b06f75db25eeb8b Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:01:18 -0800 Subject: [PATCH 01/16] Removed Boilr From cript as its no longer needed due to NSLGameScanner ~also removed the "find games" button --- NonSteamLaunchers.sh | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index ad79d2e..6830ccc 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -620,10 +620,10 @@ separate_app_ids=false # Check if any command line arguments were provided if [ ${#args[@]} -eq 0 ]; then # No command line arguments were provided, so display the main zenity window - selected_launchers=$(zenity --list --text="Which launchers do you want to download and install?" --checklist --column="$version" --column="Default = one App ID Installation, One Prefix, NonSteamLaunchers - opening this window has updated NSLGameScanner.py $live" FALSE "SEPARATE APP IDS - CHECK THIS TO SEPARATE YOUR PREFIX" $epic_games_value "$epic_games_text" $gog_galaxy_value "$gog_galaxy_text" $uplay_value "$uplay_text" $battlenet_value "$battlenet_text" $amazongames_value "$amazongames_text" $eaapp_value "$eaapp_text" $legacygames_value "$legacygames_text" $itchio_value "$itchio_text" $humblegames_value "$humblegames_text" $indiegala_value "$indiegala_text" $rockstar_value "$rockstar_text" $glyph_value "$glyph_text" $minecraft_value "$minecraft_text" $psplus_value "$psplus_text" $vkplay_value "$vkplay_text" FALSE "Xbox Game Pass" FALSE "GeForce Now" FALSE "Amazon Luna" FALSE "Netflix" FALSE "Hulu" FALSE "Disney+" FALSE "Amazon Prime Video" FALSE "movie-web" FALSE "Youtube" FALSE "Twitch" --width=580 --height=740 --extra-button="Uninstall" --extra-button="Find Games" --extra-button="Start Fresh" --extra-button="Move to SD Card" --extra-button="Stop NSLGameScanner") + selected_launchers=$(zenity --list --text="Which launchers do you want to download and install?" --checklist --column="$version" --column="Default = one App ID Installation, One Prefix, NonSteamLaunchers - updated the NSLGameScanner.py $live" FALSE "SEPARATE APP IDS - CHECK THIS TO SEPARATE YOUR PREFIX" $epic_games_value "$epic_games_text" $gog_galaxy_value "$gog_galaxy_text" $uplay_value "$uplay_text" $battlenet_value "$battlenet_text" $amazongames_value "$amazongames_text" $eaapp_value "$eaapp_text" $legacygames_value "$legacygames_text" $itchio_value "$itchio_text" $humblegames_value "$humblegames_text" $indiegala_value "$indiegala_text" $rockstar_value "$rockstar_text" $glyph_value "$glyph_text" $minecraft_value "$minecraft_text" $psplus_value "$psplus_text" $vkplay_value "$vkplay_text" FALSE "Xbox Game Pass" FALSE "GeForce Now" FALSE "Amazon Luna" FALSE "Netflix" FALSE "Hulu" FALSE "Disney+" FALSE "Amazon Prime Video" FALSE "movie-web" FALSE "Youtube" FALSE "Twitch" --width=800 --height=740 --extra-button="Uninstall" --extra-button="Stop NSLGameScanner" --extra-button="Start Fresh" --extra-button="Move to SD Card") # Check if the user clicked the 'Cancel' button or selected one of the extra buttons - if [ $? -eq 1 ] || [[ $selected_launchers == "Start Fresh" ]] || [[ $selected_launchers == "Move to SD Card" ]] || [[ $selected_launchers == "Uninstall" ]] || [[ $selected_launchers == "Find Games" ]]; then + if [ $? -eq 1 ] || [[ $selected_launchers == "Start Fresh" ]] || [[ $selected_launchers == "Move to SD Card" ]] || [[ $selected_launchers == "Uninstall" ]]; then # The user clicked the 'Cancel' button or selected one of the extra buttons, so skip prompting for custom websites custom_websites=() else @@ -680,7 +680,7 @@ else fi # Check if the cancel button was clicked -if [ $? -eq 1 ] && [[ $options != "Start Fresh" ]] && [[ $options != "Move to SD Card" ]] && [[ $options != "Uninstall" ]] && [[ $options != "Find Games" ]]; then +if [ $? -eq 1 ] && [[ $options != "Start Fresh" ]] && [[ $options != "Move to SD Card" ]] && [[ $options != "Uninstall" ]]; then # The cancel button was clicked echo "The cancel button was clicked" exit 1 @@ -1177,30 +1177,7 @@ fi -# Check if the user clicked the "Find Games" button -if [[ $options == "Find Games" ]]; then - # The Find Games button was clicked - # Check if the NonSteamLaunchersInstallation directory exists - if [[ ! -d "$download_dir" ]]; then - # The directory does not exist, so create it - mkdir -p "$download_dir" - fi - # Download the latest BoilR from GitHub (Linux version) - mkdir -p "$download_dir" - cd "$download_dir" - wget https://github.com/PhilipK/BoilR/releases/download/v.1.9.4/linux_BoilR - - # Add execute permissions to the linux_BoilR file - chmod +x linux_BoilR - - # TODO: brittle subshell proces; should ~~create working directory variable~~ [edit: `download_dir`] and launch explicitly with `bash -c "linux_BoilR"` - # Run BoilR from the current directory - ./linux_BoilR - - # Exit the script - exit -fi # TODO: probably better to break this subshell into a function that can then be redirected to zenity # Massive subshell pipes into `zenity --progress` around L2320 for GUI rendering From 1d9d70c7557efbe94c51297f6a54366b336337d4 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:02:42 -0800 Subject: [PATCH 02/16] removed Boilr from Script --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 717d621..79631dd 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,8 @@ Supported Streaming Sites for games and as well as any website. 🌐 - movie-web ✔️

-Find Games -

- -Use the "Find Games" button to load [Boilr](https://github.com/PhilipK/BoilR) this will open Boilr for you to set your settings so you can find your games easier. +Finds Games Automatically + "NSLGameScanner.service" is also live when you use this script and continues after the script is closed and even works after your Steam Deck has restarted. This works in the background as a service file to automatically add your games to your library on every Steam restart. Currently adds: - Epic Games 🎮 From 0c5513c40984cb366d728b5a0cc09c7f4ccc42bf Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:17:42 -0800 Subject: [PATCH 03/16] Add files via upload --- NSLGameScanner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 439d217..c6508ff 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -580,7 +580,7 @@ def getGogGameInfo(filePath): game_name = re.findall(r'\"(.+?)\"', split_line[1]) if game_name: game_name = game_name[0] - if "exe" in line and "GOG Galaxy" in line: + if "exe" in line and "GOG Galaxy" in line and not "unins000.exe" in line: exe_path = re.findall(r'\"(.+?)\"', split_line[1]) if exe_path: exe_path = exe_path[0].replace('\\\\', '\\') From b3ff527734cbf29709c960af176935c763b5aec7 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 7 Feb 2024 05:00:50 -0800 Subject: [PATCH 04/16] Add files via upload --- NSLGameScanner.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index c6508ff..98e8db4 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -875,7 +875,7 @@ if amazon_games: -#Push down when more scanners are added +# Push down when more scanners are added # Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed if new_shortcuts_added or shortcuts_updated: print(f"Saving new config and shortcuts files") @@ -884,10 +884,34 @@ if new_shortcuts_added or shortcuts_updated: file.write(conf) with open(f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf", 'wb') as file: file.write(vdf.binary_dumps(shortcuts)) + # Print the created shortcuts if created_shortcuts: print("Created Shortcuts:") for name in created_shortcuts: print(name) + # Assuming 'games' is a list of game dictionaries + games = [shortcut for shortcut in shortcuts['shortcuts'].values()] + + for game in games: + # Skip if 'appname' or 'exe' is None + if game.get('appname') is None or game.get('exe') is None: + continue + + # Create a dictionary to hold the shortcut information + shortcut_info = { + 'appid': str(game.get('appid')), + 'appname': game.get('appname'), + 'exe': game.get('exe'), + 'StartDir': game.get('StartDir'), + 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", + 'LaunchOptions': game.get('LaunchOptions'), + 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined + } + + # Print the shortcut information in JSON format + print(json.dumps(shortcut_info), flush=True) + print("All finished!") + From 749c85a3d958afeddc0941ac088b6672172b611a Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 7 Feb 2024 05:31:13 -0800 Subject: [PATCH 05/16] Update NonSteamLaunchers.sh --- NonSteamLaunchers.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 6830ccc..deb2fbd 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -42,6 +42,11 @@ check_for_updates() { fi } +PIPE_PATH="/tmp/NSLGameScanner_pipe" + +if [[ ! -p $PIPE_PATH ]]; then + mkfifo $PIPE_PATH +fi # Get the command line arguments args=("$@") From 95297a909077dbdbe9838ae529e22783eea79ef8 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 7 Feb 2024 05:34:52 -0800 Subject: [PATCH 06/16] Update NonSteamLaunchers.sh --- NonSteamLaunchers.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index deb2fbd..55a2bf2 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -42,11 +42,6 @@ check_for_updates() { fi } -PIPE_PATH="/tmp/NSLGameScanner_pipe" - -if [[ ! -p $PIPE_PATH ]]; then - mkfifo $PIPE_PATH -fi # Get the command line arguments args=("$@") @@ -146,7 +141,13 @@ if [ "$decky_plugin" = true ]; then if [ -f "$env_vars" ]; then # If the env_vars file exists, run the .py file and continue with the script echo "Decky Plugin argument set and env_vars file found. Running the .py file..." - python3 $python_script_path + PIPE_PATH="/tmp/NSLGameScanner_pipe" + + if [[ ! -p $PIPE_PATH ]]; then + mkfifo $PIPE_PATH + fi + + python3 $python_script_path > $PIPE_PATH echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script From 065aa30b7ff89838ab017891e0c035f414757c49 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 7 Feb 2024 06:24:48 -0800 Subject: [PATCH 07/16] Update NonSteamLaunchers.sh --- NonSteamLaunchers.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 55a2bf2..3c9feeb 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -141,13 +141,13 @@ if [ "$decky_plugin" = true ]; then if [ -f "$env_vars" ]; then # If the env_vars file exists, run the .py file and continue with the script echo "Decky Plugin argument set and env_vars file found. Running the .py file..." - PIPE_PATH="/tmp/NSLGameScanner_pipe" + #PIPE_PATH="/tmp/NSLGameScanner_pipe" - if [[ ! -p $PIPE_PATH ]]; then - mkfifo $PIPE_PATH - fi + #if [[ ! -p $PIPE_PATH ]]; then + #mkfifo $PIPE_PATH + #fi - python3 $python_script_path > $PIPE_PATH + python3 $python_script_path #> #$PIPE_PATH echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script From 92f86a167194e514e3521d42cb66f89d8743f69d Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 7 Feb 2024 19:35:05 -0800 Subject: [PATCH 08/16] Update NonSteamLaunchers.sh --- NonSteamLaunchers.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 3c9feeb..55a2bf2 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -141,13 +141,13 @@ if [ "$decky_plugin" = true ]; then if [ -f "$env_vars" ]; then # If the env_vars file exists, run the .py file and continue with the script echo "Decky Plugin argument set and env_vars file found. Running the .py file..." - #PIPE_PATH="/tmp/NSLGameScanner_pipe" + PIPE_PATH="/tmp/NSLGameScanner_pipe" - #if [[ ! -p $PIPE_PATH ]]; then - #mkfifo $PIPE_PATH - #fi + if [[ ! -p $PIPE_PATH ]]; then + mkfifo $PIPE_PATH + fi - python3 $python_script_path #> #$PIPE_PATH + python3 $python_script_path > $PIPE_PATH echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script From 744eb4ddfe75f8e826a342b4a07c58b9cf221801 Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:19:02 +0000 Subject: [PATCH 09/16] Add files via upload --- NSLGameScanner.py | 406 +++++++++++++++++++++++++++++++-------- NonSteamLaunchers.sh | 441 +++---------------------------------------- 2 files changed, 354 insertions(+), 493 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 98e8db4..bea30ce 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -28,13 +28,16 @@ with open(env_vars_path, 'r') as f: for line in lines: if line.startswith('export '): line = line[7:] # Remove 'export ' - name, value = line.strip().split('=') + name, value = line.strip().split('=', 1) os.environ[name] = value # Variables from NonSteamLaunchers.sh steamid3 = os.environ['steamid3'] logged_in_home = os.environ['logged_in_home'] compat_tool_name = os.environ['compat_tool_name'] +controller_config_path = os.environ['controller_config_path'] +python_version = os.environ['python_version'] +#Scanner Variables epic_games_launcher = os.environ.get('epic_games_launcher', '') ubisoft_connect_launcher = os.environ.get('ubisoft_connect_launcher', '') ea_app_launcher = os.environ.get('ea_app_launcher', '') @@ -42,6 +45,31 @@ gog_galaxy_launcher = os.environ.get('gog_galaxy_launcher', '') bnet_launcher = os.environ.get('bnet_launcher', '') amazon_launcher = os.environ.get('amazon_launcher', '') + +#Variables of the Launchers +# Define the path of the Launchers +epicshortcutdirectory = os.environ.get('epicshortcutdirectory') +gogshortcutdirectory = os.environ.get('gogshortcutdirectory') +uplayshortcutdirectory = os.environ.get('uplayshortcutdirectory') +battlenetshortcutdirectory = os.environ.get('battlenetshortcutdirectory') +eaappshortcutdirectory = os.environ.get('eaappshortcutdirectory') +amazonshortcutdirectory = os.environ.get('amazonshortcutdirectory') +itchioshortcutdirectory = os.environ.get('itchioshortcutdirectory') +legacyshortcutdirectory = os.environ.get('legacyshortcutdirectory') +humbleshortcutdirectory = os.environ.get('humbleshortcutdirectory') +indieshortcutdirectory = os.environ.get('indieshortcutdirectory') +rockstarshortcutdirectory = os.environ.get('rockstarshortcutdirectory') +glyphshortcutdirectory = os.environ.get('glyphshortcutdirectory') +minecraftshortcutdirectory = os.environ.get('minecraftshortcutdirectory') +psplusshortcutdirectory = os.environ.get('psplusshortcutdirectory') +vkplayhortcutdirectory = os.environ.get('vkplayhortcutdirectory') +#Streaming +chromedirectory = os.environ.get('chromedirectory') +websites_str = os.environ.get('custom_websites_str') +custom_websites = websites_str.split(', ') if websites_str else [] + + + # Define the parent folder parent_folder = f"{logged_in_home}/.config/systemd/user/Modules" @@ -263,88 +291,224 @@ def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, lau #End of Code -#Finding the Launchers and applying artwork to already made shortcuts from NonSteamLaunchers.sh -# List of game launchers to look for -game_launchers = { - 'Epic Games', - 'Gog Galaxy', - 'Ubisoft Connect', - 'Battle.net', - 'EA App', - 'Amazon Games', - 'itch.io', - 'Legacy Games', - 'Humble Bundle', - 'Glyph', - 'IndieGala Client', - 'Rockstar Games Launcher', - 'Minecraft: Java Edition', - 'Playstation Plus', - 'DMM Games', - 'VK Play' + + +#Start of Refactoring code from the .sh file +sys.path.insert(0, os.path.expanduser(f"{logged_in_home}/Downloads/NonSteamLaunchersInstallation/lib/python{python_version}/site-packages")) +print(sys.path) + + +# Create an empty dictionary to store the app IDs +app_ids = {} +#Create Launcher Shortcuts +def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): + print(f"Creating new entry for {appname}...") + print(f"Shortcut directory: {shortcutdirectory}") + print(f"Launch options: {launchoptions}") + print(f"Starting directory: {startingdir}") + # Check if the launcher is installed + if not shortcutdirectory: + print(f"{appname} is not installed. Skipping.") + return + # Check if the game already exists in the shortcuts + exe_path = f"\"{shortcutdirectory}\"" + signed_shortcut_id = get_steam_shortcut_id(exe_path, appname) + print(f"Signed shortcut ID for {appname}: {signed_shortcut_id}") + # Only store the app ID for specific launchers + if appname in ['Epic Games', 'Gog Galaxy', 'Ubisoft Connect', 'Battle.net', 'EA App', 'Amazon Games', 'itch.io', 'Legacy Games', 'Humble Bundle', 'IndieGala Client', 'Rockstar Games Launcher', 'Glyph', 'Minecraft: Java Edition', 'Playstation Plus', 'VK Play']: + app_ids[appname] = signed_shortcut_id + print(f"Stored app ID for {appname}: {signed_shortcut_id}") + unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) + print(f"Unsigned shortcut ID for {appname}: {unsigned_shortcut_id}") + if check_if_shortcut_exists(signed_shortcut_id, appname, exe_path, startingdir, launchoptions): + print(f"Shortcut already exists for {appname}.") + if add_compat_tool(unsigned_shortcut_id): + print(f"Added compatibility tool for {appname}.") + shortcuts_updated = True + return + + # Create a new entry for the Steam shortcut + game_id = get_game_id(appname) + print(f"Game ID for {appname}: {game_id}") + new_entry = { + 'appid': str(signed_shortcut_id), + 'appname': appname, + 'exe': exe_path, + 'StartDir': startingdir, + 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}", + 'LaunchOptions': launchoptions, + 'GameID': game_id if game_id is not None else "default_game_id" + } + + # Add the new entry to the shortcuts dictionary + shortcuts['shortcuts'][str(signed_shortcut_id)] = new_entry + print(f"Added new entry for {appname} to shortcuts.") + new_shortcuts_added = True + if game_id is not None: + get_sgdb_art(game_id, unsigned_shortcut_id) + add_compat_tool(unsigned_shortcut_id) + + + + + + +create_new_entry(os.environ.get('epicshortcutdirectory'), 'Epic Games', os.environ.get('epiclaunchoptions'), os.environ.get('epicstartingdir')) +create_new_entry(os.environ.get('gogshortcutdirectory'), 'Gog Galaxy', os.environ.get('goglaunchoptions'), os.environ.get('gogstartingdir')) +create_new_entry(os.environ.get('uplayshortcutdirectory'), 'Ubisoft Connect', os.environ.get('uplaylaunchoptions'), os.environ.get('uplaystartingdir')) +create_new_entry(os.environ.get('battlenetshortcutdirectory'), 'Battle.net', os.environ.get('battlenetlaunchoptions'), os.environ.get('battlenetstartingdir')) +create_new_entry(os.environ.get('eaappshortcutdirectory'), 'EA App', os.environ.get('eaapplaunchoptions'), os.environ.get('eaappstartingdir')) +create_new_entry(os.environ.get('amazonshortcutdirectory'), 'Amazon Games', os.environ.get('amazonlaunchoptions'), os.environ.get('amazonstartingdir')) +create_new_entry(os.environ.get('itchioshortcutdirectory'), 'itch.io', os.environ.get('itchiolaunchoptions'), os.environ.get('itchiostartingdir')) +create_new_entry(os.environ.get('legacyshortcutdirectory'), 'Legacy Games', os.environ.get('legacylaunchoptions'), os.environ.get('legacystartingdir')) +create_new_entry(os.environ.get('humbleshortcutdirectory'), 'Humble Bundle', os.environ.get('humblelaunchoptions'), os.environ.get('humblestartingdir')) +create_new_entry(os.environ.get('indieshortcutdirectory'), 'IndieGala Client', os.environ.get('indielaunchoptions'), os.environ.get('indiestartingdir')) +create_new_entry(os.environ.get('rockstarshortcutdirectory'), 'Rockstar Games Launcher', os.environ.get('rockstarlaunchoptions'), os.environ.get('rockstarstartingdir')) +create_new_entry(os.environ.get('glyphshortcutdirectory'), 'Glyph', os.environ.get('glyphlaunchoptions'), os.environ.get('glyphstartingdir')) +create_new_entry(os.environ.get('minecraftshortcutdirectory'), 'Minecraft: Java Edition', os.environ.get('minecraftlaunchoptions'), os.environ.get('minecraftstartingdir')) +create_new_entry(os.environ.get('psplusshortcutdirectory'), 'Playstation Plus', os.environ.get('pspluslaunchoptions'), os.environ.get('psplusstartingdir')) +create_new_entry(os.environ.get('vkplayhortcutdirectory'), 'VK Play', os.environ.get('vkplaylaunchoptions'), os.environ.get('vkplaystartingdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Xbox Game Pass', os.environ.get('xboxchromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'GeForce Now', os.environ.get('geforcechromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Netflix', os.environ.get('netlfixchromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Hulu', os.environ.get('huluchromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Disney+', os.environ.get('disneychromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Amazon Prime Video', os.environ.get('amazonchromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Youtube', os.environ.get('youtubechromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Amazon Luna', os.environ.get('lunachromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'Twitch', os.environ.get('twitchchromelaunchoptions'), os.environ.get('chrome_startdir')) +create_new_entry(os.environ.get('chromedirectory'), 'movie-web', os.environ.get('moviewebchromelaunchoptions'), os.environ.get('chrome_startdir')) + + + +# Iterate over each custom website +for custom_website in custom_websites: + # Check if the custom website is not an empty string + if custom_website: + # Remove any leading or trailing spaces from the custom website URL + custom_website = custom_website.strip() + + # Remove the 'http://' or 'https://' prefix and the 'www.' prefix, if present + clean_website = custom_website.replace('http://', '').replace('https://', '').replace('www.', '') + + # Define a regular expression pattern to extract the game name from the URL + pattern = r'/games/([\w-]+)' + + # Use the regular expression to search for the game name in the custom website URL + match = re.search(pattern, custom_website) + + # Check if a match was found + if match: + # Extract the game name from the match object + game_name = match.group(1) + + # Replace hyphens with spaces + game_name = game_name.replace('-', ' ') + + # Capitalize the first letter of each word in the game name + game_name = game_name.title() + else: + # Use the entire URL as the entry name + game_name = clean_website + + # Define the launch options for this website + chromelaunch_options = f'run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://{clean_website}/ --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar' + + # Call the create_new_entry function for this website + create_new_entry(os.environ['chromedirectory'], game_name, chromelaunch_options, os.environ['chrome_startdir']) + +#End of Creating Launcher Shortcuts + + + + + + + +# Iterate over each launcher in the app_ids dictionary +for launcher_name, appid in app_ids.items(): + print(f"The app ID for {launcher_name} is {appid}") + + + +# Get the app ID for the first launcher that the user chose to instally +appid = app_ids.get(launcher_name) + +#Create User Friendly Symlinks for the launchers +# Define the path to the compatdata directory +compatdata_dir = f'{logged_in_home}/.local/share/Steam/steamapps/compatdata' + +# Define a dictionary of original folder names +folder_names = { + 'Epic Games': 'EpicGamesLauncher', + 'Gog Galaxy': 'GogGalaxyLauncher', + 'Ubisoft Connect': 'UplayLauncher', + 'Battle.net': 'Battle.netLauncher', + 'EA App': 'TheEAappLauncher', + 'Amazon Games': 'AmazonGamesLauncher', + 'itch.io': 'itchioLauncher', + 'Legacy Games': 'LegacyGamesLauncher', + 'Humble Bundle': 'HumbleGamesLauncher', + 'IndieGala Client': 'IndieGalaLauncher', + 'Rockstar Games Launcher': 'RockstarGamesLauncher', + 'Minecraft: Java Edition': 'MinecraftLauncher', + 'Playstation Plus': 'PlaystationPlusLauncher', + 'VK Play': 'VKPlayLauncher', } -#Chrome Based "Launchers" -chrome_launchers = { - 'Hulu', - 'Twitch', - 'Amazon Luna', - 'Youtube', - 'Amazon Prime Video', - 'Disney+', - 'Netflix', - 'GeForce Now', - 'Xbox Game Pass', - 'movie-web' -} +# Iterate over each launcher in the folder_names dictionary +for launcher_name, folder in folder_names.items(): + # Define the current path of the folder + current_path = os.path.join(compatdata_dir, folder) -# Mapping between shortcut names and SteamGridDB names -name_mapping = { - 'Epic Games': 'Epic Games Store (Program)', - 'Gog Galaxy': 'GOG Galaxy (Program)', - 'Ubisoft Connect': 'Ubisoft Connect (Program)', - 'Battle.net': 'Battle.net (Program)', - 'Legacy Games': 'Legacy Games (Program)', - 'Humble Bundle': 'Humble Bundle (Website)', - 'VK Play': 'VK Play (Website)', - 'Disney+': 'Disney+ (Website)' - # Add more mappings as needed -} + # Check if the folder exists + if os.path.exists(current_path): + print(f'{launcher_name}: {folder} exists') + # Get the app ID for this launcher from the app_id_to_name dictionary + appid = app_ids.get(launcher_name) -# Iterate over the shortcuts -for shortcut in shortcuts['shortcuts'].values(): - # Check if the shortcut is a game launcher - app_name = shortcut.get('appname') - if app_name in game_launchers: - print(f"Found game launcher: {app_name}") - # Use the actual app ID instead of generating one - app_id = shortcut.get('appid') - display_name = shortcut.get('appname') - exe_path = shortcut.get('exe') - signed_shortcut_id = get_steam_shortcut_id(exe_path, display_name) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - print(f"App ID for {app_name}: {app_id}") - # Check if the shortcut doesn't have artwork - artwork_path = f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{unsigned_shortcut_id}.png" - if not os.path.exists(artwork_path): - print(f"No artwork found for {app_name}, downloading...") - # Get the game ID from SteamGridDB - steamgriddb_name = name_mapping.get(app_name, app_name) - game_id = get_game_id(steamgriddb_name) - if game_id is not None: - print(f"Got game ID from SteamGridDB: {game_id}") - # Download and apply artwork - get_sgdb_art(game_id, unsigned_shortcut_id) - new_shortcuts_added = True - # Only add compat tool if not a chrome launcher - if app_name not in chrome_launchers: - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True + # Define the new path of the folder + new_path = os.path.join(compatdata_dir, str(appid)) + + # Rename the folder + os.rename(current_path, new_path) + + # Define the path of the symbolic link + symlink_path = os.path.join(compatdata_dir, folder) + + # Create a symbolic link to the renamed folder + os.symlink(new_path, symlink_path) + else: + print(f'{launcher_name}: {folder} does not exist') +# Check if the NonSteamLaunchers folder exists +if os.path.exists(os.path.join(compatdata_dir, 'NonSteamLaunchers')): + # Get the first app ID from the app_ids list + first_app_id = next(iter(app_ids.values())) + + # Define the current path of the NonSteamLaunchers folder + current_path = os.path.join(compatdata_dir, 'NonSteamLaunchers') + + # Check if NonSteamLaunchers is already a symbolic link + if os.path.islink(current_path): + print('NonSteamLaunchers is already a symbolic link') + else: + # Define the new path of the NonSteamLaunchers folder + new_path = os.path.join(compatdata_dir, str(first_app_id)) + + # Move the NonSteamLaunchers folder to the new path + shutil.move(current_path, new_path) + + # Define the path of the symbolic link + symlink_path = os.path.join(compatdata_dir, 'NonSteamLaunchers') + + # Create a symbolic link to the renamed NonSteamLaunchers folder + os.symlink(new_path, symlink_path) + +#End of Refactoring python code from .sh file -# End of finding the Launchers and applying artwork to already made shortcuts from NonSteamLaunchers.sh # Print the existing shortcuts @@ -356,7 +520,7 @@ for shortcut in shortcuts['shortcuts'].values(): - +#Scanners # Epic Games Scanner item_dir = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{epic_games_launcher}/pfx/drive_c/ProgramData/Epic/EpicGamesLauncher/Data/Manifests/" dat_file_path = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{epic_games_launcher}/pfx/drive_c/ProgramData/Epic/UnrealEngineLauncher/LauncherInstalled.dat" @@ -884,14 +1048,14 @@ if new_shortcuts_added or shortcuts_updated: file.write(conf) with open(f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf", 'wb') as file: file.write(vdf.binary_dumps(shortcuts)) - + # Print the created shortcuts if created_shortcuts: print("Created Shortcuts:") for name in created_shortcuts: print(name) - # Assuming 'games' is a list of game dictionaries +# Assuming 'games' is a list of game dictionaries games = [shortcut for shortcut in shortcuts['shortcuts'].values()] for game in games: @@ -915,3 +1079,89 @@ if new_shortcuts_added or shortcuts_updated: print("All finished!") +# Load the configset_controller_neptune.vdf file +with open(controller_config_path, 'r') as f: + config = vdf.load(f) +#Setting Controller Layouts +# Add new entries for the games +for app_id in app_ids: + config['controller_config'][str(app_id)] = { + 'workshop': 'workshop_id' + } + +# Add new entries for the installed launchers and games +config['controller_config']['epic games'] = { + 'workshop': '2800178806' +} +config['controller_config']['gog galaxy'] = { + 'workshop': '2877189386' +} +config['controller_config']['ubisoft connect'] = { + 'workshop': '2804140248' +} +config['controller_config']['amazon games'] = { + 'workshop': '2871935783' +} +config['controller_config']['battlenet'] = { + 'workshop': '2887894308' +} +config['controller_config']['rockstar games launcher'] = { + 'workshop': '1892570391' +} +config['controller_config']['indiegala'] = { + 'template': 'controller_neptune_webbrowser.vdf' +} +config['controller_config']['legacy games'] = { + 'template': 'controller_neptune_webbrowser.vdf' +} +config['controller_config']['ea app'] = { + 'workshop': '2899822740' +} +config['controller_config']['itchio'] = { + 'workshop': '2845891813' +} +config['controller_config']['humble games collection'] = { + 'workshop': '2883791560' +} +config['controller_config']['minecraft java edition'] = { + 'workshop': '2980553929' +} +config['controller_config']['playstation plus'] = { + 'workshop': 'controller_neptune_webbrowser.vdf' +} +config['controller_config']['glyph'] = { + 'template': 'controller_neptune_webbrowser.vdf' +} +config['controller_config']['vk play'] = { + 'workshop': '3202642880' +} +config['controller_config']['amazon prime video'] = { + 'workshop': '2970669392' +} +config['controller_config']['hulu'] = { + 'workshop': '2970669392' +} +config['controller_config']['netflix'] = { + 'workshop': '2970669392' +} +config['controller_config']['disney+'] = { + 'workshop': '2970669392' +} +config['controller_config']['youtube'] = { + 'workshop': '2970669392' +} +config['controller_config']['geforce now'] = { + 'template': 'controller_neptune_gamepad+mouse.vdf' +} +config['controller_config']['amazon luna'] = { + 'template': 'controller_neptune_gamepad+mouse.vdf' +} +config['controller_config']['twitch'] = { + 'workshop': '2875543745' +} +config['controller_config']['movie-web'] = { + 'workshop': 'controller_neptune_webbrowser.vdf' +} +#End of Setting Controller Layouts +with open(controller_config_path, 'w') as f: + vdf.dump(config, f) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 55a2bf2..687599a 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -141,12 +141,12 @@ if [ "$decky_plugin" = true ]; then if [ -f "$env_vars" ]; then # If the env_vars file exists, run the .py file and continue with the script echo "Decky Plugin argument set and env_vars file found. Running the .py file..." - PIPE_PATH="/tmp/NSLGameScanner_pipe" + PIPE_PATH="/tmp/NSLGameScanner_pipe" if [[ ! -p $PIPE_PATH ]]; then mkfifo $PIPE_PATH fi - + python3 $python_script_path > $PIPE_PATH echo "Python script ran. Continuing with the script..." else @@ -1181,10 +1181,6 @@ if [[ " ${args[@]} " =~ " Stop NSLGameScanner " ]] || [[ $options == "Stop NSLGa fi - - - - # TODO: probably better to break this subshell into a function that can then be redirected to zenity # Massive subshell pipes into `zenity --progress` around L2320 for GUI rendering ( @@ -2187,6 +2183,9 @@ if [[ -f "$epic_games_launcher_path1" ]]; then epicshortcutdirectory="\"$epic_games_launcher_path1\" -opengl" epiclaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" epicstartingdir="\"$(dirname "$epic_games_launcher_path1")\"" + echo "export epicshortcutdirectory=$epicshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export epiclaunchoptions=$epiclaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export epicstartingdir=$epicstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export epic_games_launcher=NonSteamLaunchers" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Epic Games Launcher found at path 1" elif [[ -f "$epic_games_launcher_path2" ]]; then @@ -2194,10 +2193,14 @@ elif [[ -f "$epic_games_launcher_path2" ]]; then epicshortcutdirectory="\"$epic_games_launcher_path2\"" epiclaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/EpicGamesLauncher/\" %command%" epicstartingdir="\"$(dirname "$epic_games_launcher_path2")\"" + echo "export epicshortcutdirectory=$epicshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export epiclaunchoptions=$epiclaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export epicstartingdir=$epicstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export epic_games_launcher=EpicGamesLauncher" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Epic Games Launcher found at path 2" fi + if [[ -f "$gog_galaxy_path1" ]]; then # Gog Galaxy Launcher is installed at path 1 gogshortcutdirectory="\"$gog_galaxy_path1\"" @@ -2634,6 +2637,7 @@ fi echo "export steamid3=$steamid3" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export logged_in_home=$logged_in_home" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export compat_tool_name=$compat_tool_name" >> ${logged_in_home}/.config/systemd/user/env_vars +echo "export python_version=$python_version" >> ${logged_in_home}/.config/systemd/user/env_vars # Detach script from Steam process @@ -2655,10 +2659,14 @@ while steam_pid > /dev/null; do sleep 5; done # Set the path to the configset_controller_neptune.vdf file controller_config_path="${logged_in_home}/.local/share/Steam/steamapps/common/Steam Controller Configs/$steamid3/config/configset_controller_neptune.vdf" + + # Check if the configset_controller_neptune.vdf file exists if [[ -f "$controller_config_path" ]]; then # Create a backup copy of the configset_controller_neptune.vdf file cp "$controller_config_path" "$controller_config_path.bak" + echo "export controller_config_path=$controller_config_path" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "Controller Config Path Found" else echo "Could not find $controller_config_path" fi @@ -2666,439 +2674,42 @@ fi -# TODO: relocate to standalone python script -# ! editorconfig will likely break this since bash uses tabs and python needs 4 spaces -# Run the Python script to create a new entry for a Steam shortcut -python3 -c " -import sys -import os -import subprocess -sys.path.insert(0, os.path.expanduser('${logged_in_home}/Downloads/NonSteamLaunchersInstallation/lib/python$python_version/site-packages')) -print(sys.path) # Add this line to print the value of sys.path -import vdf # Updated import -import binascii -import re -import shutil - -# Print the path to the file where the vdf module was loaded from -print(vdf.__file__) - -# Load the shortcuts.vdf file -with open('$shortcuts_vdf_path', 'rb') as f: - shortcuts = vdf.binary_load(f) - -# Check if the 'shortcuts' key exists in the dictionary -if 'shortcuts' not in shortcuts: - # Create an empty 'shortcuts' entry - shortcuts['shortcuts'] = {} - -# Check the format of the 'shortcuts' entry -if isinstance(shortcuts['shortcuts'], dict): - # The 'shortcuts' entry is a dictionary - for key, value in shortcuts['shortcuts'].items(): - # Check the type of the value - if not isinstance(value, (str, int, dict)): - pass - -# Define the path of the Launchers -epicshortcutdirectory = '$epicshortcutdirectory' -gogshortcutdirectory = '$gogshortcutdirectory' -uplayshortcutdirectory = '$uplayshortcutdirectory' -battlenetshortcutdirectory = '$battlenetshortcutdirectory' -eaappshortcutdirectory = '$eaappshortcutdirectory' -amazonshortcutdirectory = '$amazonshortcutdirectory' -itchioshortcutdirectory = '$itchioshortcutdirectory' -legacyshortcutdirectory = '$legacyshortcutdirectory' -humbleshortcutdirectory = '$humbleshortcutdirectory' -indieshortcutdirectory = '$indieshortcutdirectory' -rockstarshortcutdirectory = '$rockstarshortcutdirectory' -glyphshortcutdirectory = '$glyphshortcutdirectory' -minecraftshortcutdirectory = '$minecraftshortcutdirectory' -psplusshortcutdirectory = '$psplusshortcutdirectory' -vkplayhortcutdirectory = '$vkplayhortcutdirectory' -#Streaming -chromedirectory = '$chromedirectory' -websites_str = '$custom_websites_str' -custom_websites = websites_str.split(', ') -START_FRESH = '$START_FRESH' - - -app_ids = [] - - -def get_steam_shortcut_id(exe, appname): - unique_id = ''.join([exe, appname]) - id_int = binascii.crc32(str.encode(unique_id)) | 0x80000000 - return id_int - - -app_id_to_name = {} - - -def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): - if shortcutdirectory != '' and launchoptions != '': - exe = f'"{shortcutdirectory}"' - appid = get_steam_shortcut_id(exe, appname) - app_ids.append(appid) - app_id_to_name[appid] = appname - - - # Create a new entry for the Steam shortcut - new_entry = { - 'appid': f'{str(appid)}' if appid is not None else '', - 'appname': appname, - 'exe': shortcutdirectory, - 'StartDir': startingdir, - 'icon': f'${logged_in_home}/.steam/root/userdata/$steamid3/config/grid/{str(appid)}-icon.ico', - 'ShortcutPath': '', - 'LaunchOptions': launchoptions, - 'IsHidden': 0, - 'AllowDesktopConfig': 1, - 'AllowOverlay': 1, - 'OpenVR': 0, - 'Devkit': 0, - 'DevkitGameID': '', - 'LastPlayTime': 0, - 'tags': { - '0': 'favorite' - } - } - - # Check if an entry with the same appid and appname already exists - for key in shortcuts['shortcuts'].keys(): - if (shortcuts['shortcuts'][key]['appid'] == new_entry['appid'] and - shortcuts['shortcuts'][key]['appname'] == new_entry['appname']): - # A duplicate entry exists, so don't add the new entry - return - - - # Add the new entry to the shortcuts dictionary - entry_exists = False - if type(shortcuts['shortcuts']) == list: - for entry in shortcuts['shortcuts']: - entry.setdefault('appname', '') - entry.setdefault('exe', '') - if entry['appname'] == new_entry['appname'] and entry['exe'] == new_entry['exe']: - entry_exists = True - break - if not entry_exists: - shortcuts['shortcuts'].append(new_entry) - elif type(shortcuts['shortcuts']) == dict: - for key in shortcuts['shortcuts'].keys(): - shortcuts['shortcuts'][key].setdefault('appname', '') - shortcuts['shortcuts'][key].setdefault('exe', '') - if shortcuts['shortcuts'][key]['appname'] == new_entry['appname'] and shortcuts['shortcuts'][key]['exe'] == new_entry['exe']: - entry_exists = True - break - if not entry_exists: - # Check if the shortcuts['shortcuts'] dictionary is empty - if not shortcuts['shortcuts']: - max_key = -1 - else: - # Find the highest key value - max_key = max(int(key) for key in shortcuts['shortcuts'].keys()) - # Add the new entry with a key value one higher than the current maximum - shortcuts['shortcuts'][str(max_key + 1)] = new_entry - - -create_new_entry('$epicshortcutdirectory', 'Epic Games', '$epiclaunchoptions', '$epicstartingdir') -create_new_entry('$gogshortcutdirectory', 'Gog Galaxy', '$goglaunchoptions', '$gogstartingdir') -create_new_entry('$uplayshortcutdirectory', 'Ubisoft Connect', '$uplaylaunchoptions', '$uplaystartingdir') -create_new_entry('$battlenetshortcutdirectory', 'Battle.net', '$battlenetlaunchoptions', '$battlenetstartingdir') -create_new_entry('$eaappshortcutdirectory', 'EA App', '$eaapplaunchoptions', '$eaappstartingdir') -create_new_entry('$amazonshortcutdirectory', 'Amazon Games', '$amazonlaunchoptions', '$amazonstartingdir') -create_new_entry('$itchioshortcutdirectory', 'itch.io', '$itchiolaunchoptions', '$itchiostartingdir') -create_new_entry('$legacyshortcutdirectory', 'Legacy Games', '$legacylaunchoptions', '$legacystartingdir') -create_new_entry('$humbleshortcutdirectory', 'Humble Bundle', '$humblelaunchoptions', '$humblestartingdir') -create_new_entry('$indieshortcutdirectory', 'IndieGala Client', '$indielaunchoptions', '$indiestartingdir') -create_new_entry('$rockstarshortcutdirectory', 'Rockstar Games Launcher', '$rockstarlaunchoptions', '$rockstarstartingdir') -create_new_entry('$glyphshortcutdirectory', 'Glyph', '$glyphlaunchoptions', '$glyphstartingdir') -create_new_entry('$minecraftshortcutdirectory', 'Minecraft: Java Edition', '$minecraftlaunchoptions', '$minecraftstartingdir') -create_new_entry('$psplusshortcutdirectory', 'Playstation Plus', '$pspluslaunchoptions', '$psplusstartingdir') -create_new_entry('$vkplayhortcutdirectory', 'VK Play', '$vkplaylaunchoptions', '$vkplaystartingdir') -create_new_entry('$chromedirectory', 'Xbox Game Pass', '$xboxchromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'GeForce Now', '$geforcechromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Netflix', '$netlfixchromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Hulu', '$huluchromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Disney+', '$disneychromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Amazon Prime Video', '$amazonchromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Youtube', '$youtubechromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Amazon Luna', '$lunachromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'Twitch', '$twitchchromelaunchoptions', '$chrome_startdir') -create_new_entry('$chromedirectory', 'movie-web', '$moviewebchromelaunchoptions', '$chrome_startdir') - - -# Iterate over each custom website -for custom_website in custom_websites: - # Check if the custom website is not an empty string - if custom_website: - # Remove any leading or trailing spaces from the custom website URL - custom_website = custom_website.strip() - - # Remove the 'http://' or 'https://' prefix and the 'www.' prefix, if present - clean_website = custom_website.replace('http://', '').replace('https://', '').replace('www.', '') - - # Define a regular expression pattern to extract the game name from the URL - pattern = r'/games/([\w-]+)' - - # Use the regular expression to search for the game name in the custom website URL - match = re.search(pattern, custom_website) - - # Check if a match was found - if match: - # Extract the game name from the match object - game_name = match.group(1) - - # Replace hyphens with spaces - game_name = game_name.replace('-', ' ') - - # Capitalize the first letter of each word in the game name - game_name = game_name.title() - else: - # Use the entire URL as the entry name - game_name = clean_website - - # Define the launch options for this website - chromelaunch_options = f'run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://{clean_website}/ --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar' - - # Call the create_new_entry function for this website - create_new_entry('$chromedirectory', game_name, chromelaunch_options, '$chrome_startdir') - -print(f'app_id_to_name: {app_id_to_name}') - -# Save the updated shortcuts dictionary to the shortcuts.vdf file -with open('$shortcuts_vdf_path', 'wb') as f: - vdf.binary_dump(shortcuts, f) - -# Writes to the config.vdf File - -excluded_appids = [] -streaming_sites = ['Netflix', 'Hulu', 'Disney+', 'Amazon Prime Video', 'Youtube', 'movie-web', 'Amazon Luna', 'Twitch', 'Xbox Game Pass', 'GeForce Now'] - -for app_id, name in app_id_to_name.items(): - if name in streaming_sites: - excluded_appids.append(app_id) - -# Remove the app IDs of the streaming sites from the app_ids list -app_ids = [app_id for app_id in app_ids if app_id_to_name[app_id] not in streaming_sites] - -# Remove the app IDs of the streaming sites from the app_id_to_name dictionary -app_id_to_name = {app_id: name for app_id, name in app_id_to_name.items() if name not in streaming_sites} -# Update the config.vdf file -with open('$config_vdf_path', 'r') as f: - config = vdf.load(f) - -# Check if the CompatToolMapping key exists -if 'CompatToolMapping' not in config['InstallConfigStore']['Software']['Valve']['Steam']: - # Create the CompatToolMapping key and set its value to an empty dictionary - config['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'] = {} - -for app_id in app_ids: - # Check if the app_id is in the list of excluded appids - if app_id not in excluded_appids: - # Update the CompatToolMapping for this app_id - if str(app_id) in config['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping']: - config['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'][str(app_id)]['name'] = '$compat_tool_name' - config['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'][str(app_id)]['config'] = '' - config['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'][str(app_id)]['priority'] = '250' - else: - config['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'][str(app_id)] = {'name': '$compat_tool_name', 'config': '', 'priority': '250'} - -# Save the updated config dictionary to the config.vdf file -with open('$config_vdf_path', 'w') as f: - vdf.dump(config, f) - -# Load the configset_controller_neptune.vdf file -with open('$controller_config_path', 'r') as f: - config = vdf.load(f) - -# Add new entries for the games -for app_id in app_ids: - config['controller_config'][str(app_id)] = { - 'workshop': 'workshop_id' - } - -# Add new entries for the installed launchers and games -config['controller_config']['epic games'] = { - 'workshop': '2800178806' -} -config['controller_config']['gog galaxy'] = { - 'workshop': '2877189386' -} -config['controller_config']['ubisoft connect'] = { - 'workshop': '2804140248' -} -config['controller_config']['amazon games'] = { - 'workshop': '2871935783' -} -config['controller_config']['battlenet'] = { - 'workshop': '2887894308' -} -config['controller_config']['rockstar games launcher'] = { - 'workshop': '1892570391' -} -config['controller_config']['indiegala'] = { - 'template': 'controller_neptune_webbrowser.vdf' -} -config['controller_config']['legacy games'] = { - 'template': 'controller_neptune_webbrowser.vdf' -} -config['controller_config']['ea app'] = { - 'workshop': '2899822740' -} -config['controller_config']['itchio'] = { - 'workshop': '2845891813' -} -config['controller_config']['humble games collection'] = { - 'workshop': '2883791560' -} -config['controller_config']['minecraft java edition'] = { - 'workshop': '2980553929' -} -config['controller_config']['playstation plus'] = { - 'workshop': 'controller_neptune_webbrowser.vdf' -} -config['controller_config']['glyph'] = { - 'template': 'controller_neptune_webbrowser.vdf' -} -config['controller_config']['vk play'] = { - 'workshop': '3202642880' -} -config['controller_config']['amazon prime video'] = { - 'workshop': '2970669392' -} -config['controller_config']['hulu'] = { - 'workshop': '2970669392' -} -config['controller_config']['netflix'] = { - 'workshop': '2970669392' -} -config['controller_config']['disney+'] = { - 'workshop': '2970669392' -} -config['controller_config']['youtube'] = { - 'workshop': '2970669392' -} -config['controller_config']['geforce now'] = { - 'template': 'controller_neptune_gamepad+mouse.vdf' -} -config['controller_config']['amazon luna'] = { - 'template': 'controller_neptune_gamepad+mouse.vdf' -} -config['controller_config']['twitch'] = { - 'workshop': '2875543745' -} -config['controller_config']['movie-web'] = { - 'workshop': 'controller_neptune_webbrowser.vdf' -} - -# Save the updated config dictionary to the configset_controller_neptune.vdf file -with open('$controller_config_path', 'w') as f: - vdf.dump(config, f) - -# Define the path to the compatdata directory -compatdata_dir = '${logged_in_home}/.local/share/Steam/steamapps/compatdata' - -# Define a dictionary of original folder names -folder_names = { - 'Epic Games': 'EpicGamesLauncher', - 'Gog Galaxy': 'GogGalaxyLauncher', - 'Ubisoft Connect': 'UplayLauncher', - 'Battle.net': 'Battle.netLauncher', - 'EA App': 'TheEAappLauncher', - 'Amazon Games': 'AmazonGamesLauncher', - 'itch.io': 'itchioLauncher', - 'Legacy Games': 'LegacyGamesLauncher', - 'Humble Bundle': 'HumbleGamesLauncher', - 'IndieGala Client': 'IndieGalaLauncher', - 'Rockstar Games Launcher': 'RockstarGamesLauncher', - 'Minecraft: Java Edition': 'MinecraftLauncher', - 'Playstation Plus': 'PlaystationPlusLauncher', - 'VK Play': 'VKPlayLauncher', -} - -# Iterate over each launcher in the folder_names dictionary -for launcher_name, folder in folder_names.items(): - # Define the current path of the folder - current_path = os.path.join(compatdata_dir, folder) - - # Check if the folder exists - if os.path.exists(current_path): - print(f'{launcher_name}: {folder} exists') - # Get the app ID for this launcher from the app_id_to_name dictionary - appid = next(key for key, value in app_id_to_name.items() if value == launcher_name) - - # Define the new path of the folder - new_path = os.path.join(compatdata_dir, str(appid)) - - # Rename the folder - os.rename(current_path, new_path) - - # Define the path of the symbolic link - symlink_path = os.path.join(compatdata_dir, folder) - - # Create a symbolic link to the renamed folder - os.symlink(new_path, symlink_path) - else: - print(f'{launcher_name}: {folder} does not exist') -# Check if the NonSteamLaunchers folder exists -if os.path.exists(os.path.join(compatdata_dir, 'NonSteamLaunchers')): - # Get the first app ID from the app_ids list - first_app_id = app_ids[0] - # Define the current path of the NonSteamLaunchers folder - current_path = os.path.join(compatdata_dir, 'NonSteamLaunchers') - - # Check if NonSteamLaunchers is already a symbolic link - if os.path.islink(current_path): - print('NonSteamLaunchers is already a symbolic link') - else: - # Define the new path of the NonSteamLaunchers folder - new_path = os.path.join(compatdata_dir, str(first_app_id)) - - # Move the NonSteamLaunchers folder to the new path - shutil.move(current_path, new_path) - - # Define the path of the symbolic link - symlink_path = os.path.join(compatdata_dir, 'NonSteamLaunchers') - - # Create a symbolic link to the renamed NonSteamLaunchers folder - os.symlink(new_path, symlink_path)" # TODO: might be better to relocate temp files to `/tmp` or even use `mktemp -d` since `rm -rf` is potentially dangerous without the `-i` flag # Delete NonSteamLaunchersInstallation subfolder in Downloads folder -rm -rf "$download_dir" +#rm -rf "$download_dir" #Setup NSLGameScanner.service # Define your Python script path -python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py" +#python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py" # Define your GitHub link -github_link="https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NSLGameScanner.py" +#github_link="https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NSLGameScanner.py" # Check if the service is already running -service_status=$(systemctl --user is-active nslgamescanner.service) +#service_status=$(systemctl --user is-active nslgamescanner.service) -if [ "$service_status" = "active" ] || [ "$service_status" = "activating" ] -then - echo "Service is already running or activating. Stopping the service..." - systemctl --user stop nslgamescanner.service -fi +#if [ "$service_status" = "active" ] || [ "$service_status" = "activating" ] +#then + #echo "Service is already running or activating. Stopping the service..." + #systemctl --user stop nslgamescanner.service +#fi -echo "Updating Python script from GitHub..." +#echo "Updating Python script from GitHub..." # Download the Python script from GitHub -curl -o $python_script_path $github_link +#curl -o $python_script_path $github_link -echo "Starting the service..." +#echo "Starting the service..." # Call your Python script python3 $python_script_path From 176b622b9700733bd5f8c6223794ff64af781749 Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:52:15 +0000 Subject: [PATCH 10/16] Add files via upload --- NSLGameScanner.py | 64 +++++++++++------------------------------------ 1 file changed, 14 insertions(+), 50 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index bea30ce..ecf66d3 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -262,6 +262,7 @@ def is_match(name1, name2): else: return False +# Add or update the proton compatibility settings def add_compat_tool(app_id): if 'CompatToolMapping' not in config_data['InstallConfigStore']['Software']['Valve']['Steam']: config_data['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'] = {} @@ -291,9 +292,6 @@ def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, lau #End of Code - - - #Start of Refactoring code from the .sh file sys.path.insert(0, os.path.expanduser(f"{logged_in_home}/Downloads/NonSteamLaunchersInstallation/lib/python{python_version}/site-packages")) print(sys.path) @@ -301,18 +299,16 @@ print(sys.path) # Create an empty dictionary to store the app IDs app_ids = {} + #Create Launcher Shortcuts def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): - print(f"Creating new entry for {appname}...") - print(f"Shortcut directory: {shortcutdirectory}") - print(f"Launch options: {launchoptions}") - print(f"Starting directory: {startingdir}") + global new_shortcuts_added + global shortcuts_updated # Check if the launcher is installed if not shortcutdirectory: print(f"{appname} is not installed. Skipping.") return - # Check if the game already exists in the shortcuts - exe_path = f"\"{shortcutdirectory}\"" + exe_path = f"{shortcutdirectory}" signed_shortcut_id = get_steam_shortcut_id(exe_path, appname) print(f"Signed shortcut ID for {appname}: {signed_shortcut_id}") # Only store the app ID for specific launchers @@ -321,16 +317,18 @@ def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): print(f"Stored app ID for {appname}: {signed_shortcut_id}") unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) print(f"Unsigned shortcut ID for {appname}: {unsigned_shortcut_id}") + # Check if the game already exists in the shortcuts if check_if_shortcut_exists(signed_shortcut_id, appname, exe_path, startingdir, launchoptions): - print(f"Shortcut already exists for {appname}.") + # Check if proton needs applying or updating if add_compat_tool(unsigned_shortcut_id): - print(f"Added compatibility tool for {appname}.") shortcuts_updated = True return + #Get artwork + game_id = get_game_id(appname) + if game_id is not None: + get_sgdb_art(game_id, unsigned_shortcut_id) # Create a new entry for the Steam shortcut - game_id = get_game_id(appname) - print(f"Game ID for {appname}: {game_id}") new_entry = { 'appid': str(signed_shortcut_id), 'appname': appname, @@ -338,22 +336,14 @@ def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): 'StartDir': startingdir, 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}", 'LaunchOptions': launchoptions, - 'GameID': game_id if game_id is not None else "default_game_id" } - - # Add the new entry to the shortcuts dictionary + # Add the new entry to the shortcuts dictionary and add proton shortcuts['shortcuts'][str(signed_shortcut_id)] = new_entry print(f"Added new entry for {appname} to shortcuts.") new_shortcuts_added = True - if game_id is not None: - get_sgdb_art(game_id, unsigned_shortcut_id) add_compat_tool(unsigned_shortcut_id) - - - - create_new_entry(os.environ.get('epicshortcutdirectory'), 'Epic Games', os.environ.get('epiclaunchoptions'), os.environ.get('epicstartingdir')) create_new_entry(os.environ.get('gogshortcutdirectory'), 'Gog Galaxy', os.environ.get('goglaunchoptions'), os.environ.get('gogstartingdir')) create_new_entry(os.environ.get('uplayshortcutdirectory'), 'Ubisoft Connect', os.environ.get('uplaylaunchoptions'), os.environ.get('uplaystartingdir')) @@ -431,8 +421,7 @@ for launcher_name, appid in app_ids.items(): print(f"The app ID for {launcher_name} is {appid}") - -# Get the app ID for the first launcher that the user chose to instally +# Get the app ID for the first launcher that the user chose to install appid = app_ids.get(launcher_name) #Create User Friendly Symlinks for the launchers @@ -541,36 +530,11 @@ if os.path.exists(dat_file_path) and os.path.exists(item_dir): exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{epic_games_launcher}/pfx/drive_c/Program Files (x86)/Epic Games/Launcher/Portal/Binaries/Win32/EpicGamesLauncher.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{epic_games_launcher}/pfx/drive_c/Program Files (x86)/Epic Games/Launcher/Portal/Binaries/Win32/\"" launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{epic_games_launcher}\" %command% -'com.epicgames.launcher://apps/{app_name}?action=launch&silent=true'" - signed_shortcut_id = get_steam_shortcut_id(exe_path, display_name) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - # Check if the game already exists in the shortcuts - if check_if_shortcut_exists(signed_shortcut_id, display_name, exe_path, start_dir, launch_options): - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True - continue - # Check if the game is still installed for game in dat_data['InstallationList']: - print(f"Checking game: {game['AppName']}") if game['AppName'] == item_data['AppName']: - print(f"Match found: {game['AppName']}") - game_id = get_game_id(display_name) - print(f"No existing shortcut found for game {display_name}. Creating new shortcut.") - created_shortcuts.append(display_name) - shortcuts['shortcuts'][str(signed_shortcut_id)] = { - 'appid': str(signed_shortcut_id), - 'appname': display_name, - 'exe': exe_path, - 'StartDir': start_dir, - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}", - 'LaunchOptions': launch_options, - 'GameID': game_id if game_id is not None else "default_game_id" - } - new_shortcuts_added = True - if game_id is not None: - get_sgdb_art(game_id, unsigned_shortcut_id) - add_compat_tool(unsigned_shortcut_id) + create_new_entry(exe_path, display_name, launch_options, start_dir) else: print("Epic Games Launcher data not found. Skipping Epic Games Scanner.") From b28f39840e9b6f522768707dfda5b886dd8aa592 Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 15:54:57 +0000 Subject: [PATCH 11/16] Add files via upload --- NSLGameScanner.py | 131 +++---------------------------------------- NonSteamLaunchers.sh | 113 +++++++++++++++++++++++++++++++------ 2 files changed, 106 insertions(+), 138 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index ecf66d3..536ecd2 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -283,11 +283,11 @@ def add_compat_tool(app_id): def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, launch_options): # Check if the game already exists in the shortcuts using the id if any(s.get('appid') == shortcut_id for s in shortcuts['shortcuts'].values()): - print(f"Existing shortcut found based on shortcut ID for game {display_name}. Skipping.") + print(f"Existing shortcut found based on shortcut ID for game {display_name}. Skipping creation.") return True # Check if the game already exists in the shortcuts using the fields (probably unnecessary) if any(s.get('appname') == display_name and s.get('exe') == exe_path and s.get('StartDir') == start_dir and s.get('LaunchOptions') == launch_options for s in shortcuts['shortcuts'].values()): - print(f"Existing shortcut found based on matching fields for game {display_name}. Skipping.") + print(f"Existing shortcut found based on matching fields for game {display_name}. Skipping creation.") return True #End of Code @@ -304,19 +304,17 @@ app_ids = {} def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): global new_shortcuts_added global shortcuts_updated + global created_shortcuts # Check if the launcher is installed if not shortcutdirectory: print(f"{appname} is not installed. Skipping.") return exe_path = f"{shortcutdirectory}" signed_shortcut_id = get_steam_shortcut_id(exe_path, appname) - print(f"Signed shortcut ID for {appname}: {signed_shortcut_id}") # Only store the app ID for specific launchers if appname in ['Epic Games', 'Gog Galaxy', 'Ubisoft Connect', 'Battle.net', 'EA App', 'Amazon Games', 'itch.io', 'Legacy Games', 'Humble Bundle', 'IndieGala Client', 'Rockstar Games Launcher', 'Glyph', 'Minecraft: Java Edition', 'Playstation Plus', 'VK Play']: app_ids[appname] = signed_shortcut_id - print(f"Stored app ID for {appname}: {signed_shortcut_id}") unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - print(f"Unsigned shortcut ID for {appname}: {unsigned_shortcut_id}") # Check if the game already exists in the shortcuts if check_if_shortcut_exists(signed_shortcut_id, appname, exe_path, startingdir, launchoptions): # Check if proton needs applying or updating @@ -341,6 +339,7 @@ def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): shortcuts['shortcuts'][str(signed_shortcut_id)] = new_entry print(f"Added new entry for {appname} to shortcuts.") new_shortcuts_added = True + created_shortcuts.append(appname) add_compat_tool(unsigned_shortcut_id) @@ -590,28 +589,7 @@ else: launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ubisoft_connect_launcher}/\" %command% \"uplay://launch/{uplay_id}/0\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ubisoft_connect_launcher}/pfx/drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher/upc.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ubisoft_connect_launcher}/pfx/drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher/\"" - signed_shortcut_id = get_steam_shortcut_id(exe_path, game) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - # Check if the game already exists in the shortcuts - if check_if_shortcut_exists(signed_shortcut_id, game, exe_path, start_dir, launch_options): - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True - continue - - game_id = get_game_id(game) - if game_id is not None: - get_sgdb_art(game_id, unsigned_shortcut_id) - new_shortcuts_added = True - created_shortcuts.append(game) - shortcuts['shortcuts'][str(len(shortcuts['shortcuts']))] = { - 'appid': str(signed_shortcut_id), - 'appname': game, - 'exe': exe_path, - 'StartDir': start_dir, - 'LaunchOptions': launch_options, - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}" - } - add_compat_tool(unsigned_shortcut_id) + create_new_entry(exe_path, game_name, launch_options, start_dir) # End of Ubisoft Game Scanner @@ -655,29 +633,7 @@ else: launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ea_app_launcher}/\" %command% \"origin2://game/launch?offerIds={ea_ids}\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ea_app_launcher}/pfx/drive_c/Program Files/Electronic Arts/EA Desktop/EA Desktop/EALaunchHelper.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ea_app_launcher}/pfx/drive_c/Program Files/Electronic Arts/EA Desktop/EA Desktop/\"" - signed_shortcut_id = get_steam_shortcut_id(exe_path, game) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - # Check if the game already exists in the shortcuts - if check_if_shortcut_exists(signed_shortcut_id, game, exe_path, start_dir, launch_options): - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True - continue - - game_id = get_game_id(game) - if game_id is not None: - get_sgdb_art(game_id, unsigned_shortcut_id) - # Check if the game already exists in the shortcuts - new_shortcuts_added = True - created_shortcuts.append(game) - shortcuts['shortcuts'][str(len(shortcuts['shortcuts']))] = { - 'appid': str(signed_shortcut_id), - 'appname': game, - 'exe': exe_path, - 'StartDir': start_dir, - 'LaunchOptions': launch_options, - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}" - } - add_compat_tool(unsigned_shortcut_id) + create_new_entry(exe_path, game_name, launch_options, start_dir) #End of EA App Scanner @@ -736,36 +692,11 @@ else: launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']} /path=\"{game_info['exe']}\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/\"" - signed_shortcut_id = get_steam_shortcut_id(exe_path, game) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - # Check if the game already exists in the shortcuts - if check_if_shortcut_exists(signed_shortcut_id, game, exe_path, start_dir, launch_options): - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True - continue - - game_id = get_game_id(game) - if game_id is not None: - get_sgdb_art(game_id, unsigned_shortcut_id) - new_shortcuts_added = True - created_shortcuts.append(game) - shortcuts['shortcuts'][str(len(shortcuts['shortcuts']))] = { - 'appid': str(signed_shortcut_id), - 'appname': game, - 'exe': exe_path, - 'StartDir': start_dir, - 'LaunchOptions': launch_options, - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}" - } - add_compat_tool(unsigned_shortcut_id) + create_new_entry(exe_path, game, launch_options, start_dir) # End of Gog Galaxy Scanner - - - - #Battle.net Scanner # Define your mapping flavor_mapping = { @@ -901,28 +832,7 @@ else: launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{bnet_launcher}/\" %command% \"battlenet://{game_info['flavor']}\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{bnet_launcher}/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net.exe\" --exec=\"launch {game_info['flavor']}\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{bnet_launcher}/pfx/drive_c/Program Files (x86)/Battle.net/\"" - signed_shortcut_id = get_steam_shortcut_id(exe_path, game) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - # Check if the game already exists in the shortcuts - if check_if_shortcut_exists(signed_shortcut_id, game, exe_path, start_dir, launch_options): - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True - continue - - game_id = get_game_id(game) - if game_id is not None: - get_sgdb_art(game_id, unsigned_shortcut_id) - new_shortcuts_added = True - created_shortcuts.append(game) - shortcuts['shortcuts'][str(len(shortcuts['shortcuts']))] = { - 'appid': str(signed_shortcut_id), - 'appname': game, - 'exe': exe_path, - 'StartDir': start_dir, - 'LaunchOptions': launch_options, - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}" - } - add_compat_tool(unsigned_shortcut_id) + create_new_entry(exe_path, game, launch_options, start_dir) # End of Battle.net Scanner @@ -972,30 +882,7 @@ if amazon_games: exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{amazon_launcher}/pfx/drive_c/users/steamuser/AppData/Local/Amazon Games/App/Amazon Games.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{amazon_launcher}/pfx/drive_c/users/steamuser/AppData/Local/Amazon Games/App/\"" launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{amazon_launcher}\" %command% -'amazon-games://play/{game['id']}'" - signed_shortcut_id = get_steam_shortcut_id(exe_path, display_name) - unsigned_shortcut_id = get_unsigned_shortcut_id(signed_shortcut_id) - - # Check if the game already exists in the shortcuts - if check_if_shortcut_exists(signed_shortcut_id, display_name, exe_path, start_dir, launch_options): - if add_compat_tool(unsigned_shortcut_id): - shortcuts_updated = True - continue - - print(f"No existing shortcut found for game {display_name}. Creating new shortcut.") - created_shortcuts.append(display_name) - shortcuts['shortcuts'][str(signed_shortcut_id)] = { - 'appid': str(signed_shortcut_id), - 'appname': display_name, - 'exe': exe_path, - 'StartDir': start_dir, - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', unsigned_shortcut_id)}", - 'LaunchOptions': launch_options, - 'GameID': get_game_id(display_name) if get_game_id(display_name) is not None else "default_game_id" - } - new_shortcuts_added = True - if get_game_id(display_name) is not None: - get_sgdb_art(get_game_id(display_name), unsigned_shortcut_id) - add_compat_tool(unsigned_shortcut_id) + create_new_entry(exe_path, display_name, launch_options, start_dir) #End of Amazon Games Scanner diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 687599a..f2cc24a 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -222,6 +222,9 @@ vkplay_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/VKPlayLa # chrome_installpath="/app/bin/chrome" chrome_path="/usr/bin/flatpak" chrome_startdir="\"/usr/bin\"" +chromedirectory="\"$chrome_path\"" +echo "export chromedirectory=$chromedirectory" >> ${logged_in_home}/.config/systemd/user/env_vars +echo "export chrome_startdir=$chrome_startdir" >> ${logged_in_home}/.config/systemd/user/env_vars # Check if Epic Games Launcher is installed function CheckInstallations { @@ -2206,6 +2209,9 @@ if [[ -f "$gog_galaxy_path1" ]]; then gogshortcutdirectory="\"$gog_galaxy_path1\"" goglaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" gogstartingdir="\"$(dirname "$gog_galaxy_path1")\"" + echo "export gogshortcutdirectory=$gogshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export goglaunchoptions=$goglaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export gogstartingdir=$gogstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export gog_galaxy_launcher=NonSteamLaunchers" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Gog Galaxy Launcher found at path 1" elif [[ -f "$gog_galaxy_path2" ]]; then @@ -2213,6 +2219,9 @@ elif [[ -f "$gog_galaxy_path2" ]]; then gogshortcutdirectory="\"$gog_galaxy_path2\"" goglaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/GogGalaxyLauncher/\" %command%" gogstartingdir="\"$(dirname "$gog_galaxy_path2")\"" + echo "export gogshortcutdirectory=$gogshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export goglaunchoptions=$goglaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export gogstartingdir=$gogstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export gog_galaxy_launcher=GogGalaxyLauncher" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Gog Galaxy Launcher found at path 2" fi @@ -2223,6 +2232,9 @@ if [[ -f "$uplay_path1" ]]; then uplayshortcutdirectory="\"$uplay_path1\"" uplaylaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" uplaystartingdir="\"$(dirname "$uplay_path1")\"" + echo "export uplayshortcutdirectory=$uplayshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export uplaylaunchoptions=$uplaylaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export uplaystartingdir=$uplaystartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export ubisoft_connect_launcher=NonSteamLaunchers" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Ubisoft Connect Launcher found at path 1" elif [[ -f "$uplay_path2" ]]; then @@ -2230,6 +2242,9 @@ elif [[ -f "$uplay_path2" ]]; then uplayshortcutdirectory="\"$uplay_path2\"" uplaylaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/UplayLauncher/\" %command%" uplaystartingdir="\"$(dirname "$uplay_path2")\"" + echo "export uplayshortcutdirectory=$uplayshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export uplaylaunchoptions=$uplaylaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export uplaystartingdir=$uplaystartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export ubisoft_connect_launcher=UplayLauncher" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Ubisoft Connect Launcher found at path 1" fi @@ -2239,6 +2254,9 @@ if [[ -f "$battlenet_path1" ]]; then battlenetshortcutdirectory="\"$battlenet_path1\"" battlenetlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" battlenetstartingdir="\"$(dirname "$battlenet_path1")\"" + echo "export battlenetshortcutdirectory=$battlenetshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export battlenetlaunchoptions=$battlenetlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export battlenetstartingdir=$battlenetstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export bnet_launcher=NonSteamLaunchers" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Battlenet Launcher found at path 1" elif [[ -f "$battlenet_path2" ]]; then @@ -2246,6 +2264,9 @@ elif [[ -f "$battlenet_path2" ]]; then battlenetshortcutdirectory="\"$battlenet_path2\"" battlenetlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/Battle.netLauncher/\" %command%" battlenetstartingdir="\"$(dirname "$battlenet_path2")\"" + echo "export battlenetshortcutdirectory=$battlenetshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export battlenetlaunchoptions=$battlenetlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export battlenetstartingdir=$battlenetstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export bnet_launcher=Battle.netLauncher" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Battlenet Launcher found at path 2" fi @@ -2255,6 +2276,9 @@ if [[ -f "$eaapp_path1" ]]; then eaappshortcutdirectory="\"$eaapp_path1\"" eaapplaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" eaappstartingdir="\"$(dirname "$eaapp_path1")\"" + echo "export eaappshortcutdirectory=$eaappshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export eaapplaunchoptions=$eaapplaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export eaappstartingdir=$eaappstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export ea_app_launcher=NonSteamLaunchers" >> ${logged_in_home}/.config/systemd/user/env_vars echo "EA App Launcher found at path 1" elif [[ -f "$eaapp_path2" ]]; then @@ -2262,6 +2286,9 @@ elif [[ -f "$eaapp_path2" ]]; then eaappshortcutdirectory="\"$eaapp_path2\"" eaapplaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/\" %command%" eaappstartingdir="\"$(dirname "$eaapp_path2")\"" + echo "export eaappshortcutdirectory=$eaappshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export eaapplaunchoptions=$eaapplaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export eaappstartingdir=$eaappstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export ea_app_launcher=TheEAappLauncher" >> ${logged_in_home}/.config/systemd/user/env_vars echo "EA App Launcher found at path 2" fi @@ -2271,6 +2298,9 @@ if [[ -f "$amazongames_path1" ]]; then amazonshortcutdirectory="\"$amazongames_path1\"" amazonlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" amazonstartingdir="\"$(dirname "$amazongames_path1")\"" + echo "export amazonshortcutdirectory=$amazonshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export amazonlaunchoptions=$amazonlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export amazonstartingdir=$amazonstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export amazon_launcher=NonSteamLaunchers" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Amazon Games Launcher found at path 1" elif [[ -f "$amazongames_path2" ]]; then @@ -2278,6 +2308,9 @@ elif [[ -f "$amazongames_path2" ]]; then amazonshortcutdirectory="\"$amazongames_path2\"" amazonlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/AmazonGamesLauncher/\" %command%" amazonstartingdir="\"$(dirname "$amazongames_path2")\"" + echo "export amazonshortcutdirectory=$amazonshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export amazonlaunchoptions=$amazonlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export amazonstartingdir=$amazonstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export amazon_launcher=AmazonGamesLauncher" >> ${logged_in_home}/.config/systemd/user/env_vars echo "Amazon Games Launcher found at path 2" fi @@ -2287,11 +2320,17 @@ if [[ -f "$itchio_path1" ]]; then itchioshortcutdirectory="\"$itchio_path1\"" itchiolaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" itchiostartingdir="\"$(dirname "$itchio_path1")\"" + echo "export itchioshortcutdirectory=$itchioshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export itchiolaunchoptions=$itchiolaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export itchiostartingdir=$itchiostartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$itchio_path2" ]]; then # itchio Launcher is installed at path 2 itchioshortcutdirectory="\"$itchio_path2\"" itchiolaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/itchioLauncher/\" %command%" itchiostartingdir="\"$(dirname "$itchio_path2")\"" + echo "export itchioshortcutdirectory=$itchioshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export itchiolaunchoptions=$itchiolaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export itchiostartingdir=$itchiostartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$legacygames_path1" ]]; then @@ -2299,11 +2338,17 @@ if [[ -f "$legacygames_path1" ]]; then legacyshortcutdirectory="\"$legacygames_path1\"" legacylaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" legacystartingdir="\"$(dirname "$legacygames_path1")\"" + echo "export legacyshortcutdirectory=$legacyshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export legacylaunchoptions=$legacylaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export legacystartingdir=$legacystartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$legacygames_path2" ]]; then # Legacy Games Launcher is installed at path 2 legacyshortcutdirectory="\"$legacygames_path2\"" legacylaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/LegacyGamesLauncher/\" %command%" legacystartingdir="\"$(dirname "$legacygames_path2")\"" + echo "export legacyshortcutdirectory=$legacyshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export legacylaunchoptions=$legacylaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export legacystartingdir=$legacystartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$humblegames_path1" ]]; then @@ -2311,11 +2356,17 @@ if [[ -f "$humblegames_path1" ]]; then humbleshortcutdirectory="\"$humblegames_path1\"" humblelaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" humblestartingdir="\"$(dirname "$humblegames_path1")\"" + echo "export humbleshortcutdirectory=$humbleshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export humblelaunchoptions=$humblelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export humblestartingdir=$humblestartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$humblegames_path2" ]]; then # Humble Games Launcher is installed at path 2 humbleshortcutdirectory="\"$humblegames_path2\"" humblelaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/HumbleGamesLauncher/\" %command%" humblestartingdir="\"$(dirname "$humblegames_path2")\"" + echo "export humbleshortcutdirectory=$humbleshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export humblelaunchoptions=$humblelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export humblestartingdir=$humblestartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$indiegala_path1" ]]; then @@ -2323,11 +2374,17 @@ if [[ -f "$indiegala_path1" ]]; then indieshortcutdirectory="\"$indiegala_path1\"" indielaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" indiestartingdir="\"$(dirname "$indiegala_path1")\"" + echo "export indieshortcutdirectory=$indieshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export indielaunchoptions=$indielaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export indiestartingdir=$indiestartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$indiegala_path2" ]]; then # indiegala Launcher is installed at path 2 indieshortcutdirectory="\"$indiegala_path2\"" indielaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/IndieGalaLauncher/\" %command%" indiestartingdir="\"$(dirname "$indiegala_path2")\"" + echo "export indieshortcutdirectory=$indieshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export indielaunchoptions=$indielaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export indiestartingdir=$indiestartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$rockstar_path1" ]]; then @@ -2335,11 +2392,17 @@ if [[ -f "$rockstar_path1" ]]; then rockstarshortcutdirectory="\"$rockstar_path1\"" rockstarlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" rockstarstartingdir="\"$(dirname "$rockstar_path1")\"" + echo "export rockstarshortcutdirectory=$rockstarshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export rockstarlaunchoptions=$rockstarlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export rockstarstartingdir=$rockstarstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$rockstar_path2" ]]; then # rockstar Launcher is installed at path 2 rockstarshortcutdirectory="\"$rockstar_path2\"" rockstarlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/RockstarGamesLauncher/\" %command%" rockstarstartingdir="\"$(dirname "$rockstar_path2")\"" + echo "export rockstarshortcutdirectory=$rockstarshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export rockstarlaunchoptions=$rockstarlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export rockstarstartingdir=$rockstarstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$glyph_path1" ]]; then @@ -2347,11 +2410,17 @@ if [[ -f "$glyph_path1" ]]; then glyphshortcutdirectory="\"$glyph_path1\"" glyphlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" glyphstartingdir="\"$(dirname "$glyph_path1")\"" + echo "export glyphshortcutdirectory=$glyphshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export glyphlaunchoptions=$glyphlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export glyphstartingdir=$glyphstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$glyph_path2" ]]; then # Glyph is installed at path 2 glyphshortcutdirectory="\"$glyph_path2\"" glyphlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/GlyphLauncher/\" %command%" glyphstartingdir="\"$(dirname "$glyph_path2")\"" + echo "export glyphshortcutdirectory=$glyphshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export glyphlaunchoptions=$glyphlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export glyphstartingdir=$glyphstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$minecraft_path1" ]]; then @@ -2359,11 +2428,17 @@ if [[ -f "$minecraft_path1" ]]; then minecraftshortcutdirectory="\"$minecraft_path1\"" minecraftlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" minecraftstartingdir="\"$(dirname "$minecraft_path1")\"" + echo "export minecraftshortcutdirectory=$minecraftshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export minecraftlaunchoptions=$minecraftlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export minecraftstartingdir=$minecraftstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$minecraft_path2" ]]; then # Minecraft is installed at path 2 minecraftshortcutdirectory="\"$minecraft_path2\"" minecraftlaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/MinecraftLauncher/\" %command%" minecraftstartingdir="\"$(dirname "$minecraft_path1")\"" + echo "export minecraftshortcutdirectory=$minecraftshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export minecraftlaunchoptions=$minecraftlaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export minecraftstartingdir=$minecraftstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$psplus_path1" ]]; then @@ -2371,11 +2446,17 @@ if [[ -f "$psplus_path1" ]]; then psplusshortcutdirectory="\"$psplus_path1\"" pspluslaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" psplusstartingdir="\"$(dirname "$psplus_path1")\"" + echo "export psplusshortcutdirectory=$psplusshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export pspluslaunchoptions=$pspluslaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export psplusstartingdir=$psplusstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$psplus_path2" ]]; then # Playstation is installed at path 2 psplusshortcutdirectory="\"$psplus_path2\"" pspluslaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/PlaystationPlusLauncher/\" %command%" psplusstartingdir="\"$(dirname "$psplus_path2")\"" + echo "export psplusshortcutdirectory=$psplusshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export pspluslaunchoptions=$pspluslaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export psplusstartingdir=$psplusstartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ -f "$vkplay_path1" ]]; then @@ -2383,11 +2464,17 @@ if [[ -f "$vkplay_path1" ]]; then vkplayhortcutdirectory="\"$vkplay_path1\"" vkplaylaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%" vkplaystartingdir="\"$(dirname "$vkplay_path1")\"" + echo "export vkplayshortcutdirectory=$vkplayshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export vkplaylaunchoptions=$vkplaylaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export vkplaystartingdir=$vkplaystartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars elif [[ -f "$vkplay_path2" ]]; then # VK Play is installed at path 2 vkplayhortcutdirectory="\"$vkplay_path2\"" vkplaylaunchoptions="STEAM_COMPAT_DATA_PATH=\"${logged_in_home}/.local/share/Steam/steamapps/compatdata/VKPlayLauncher/\" %command%" vkplaystartingdir="\"$(dirname "$vkplay_path2")\"" + echo "export vkplayshortcutdirectory=$vkplayshortcutdirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export vkplaylaunchoptions=$vkplaylaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export vkplaystartingdir=$vkplaystartingdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi @@ -2396,62 +2483,62 @@ fi if [[ $options == *"Xbox Game Pass"* ]]; then # User selected Xbox Game Pass - chromedirectory="\"$chrome_path\"" xboxchromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.xbox.com/play --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export xboxchromelaunchoptions=$xboxchromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Netflix"* ]]; then # User selected Netflix - chromedirectory="\"$chrome_path\"" netlfixchromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.netflix.com --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export netflixchromelaunchoptions=$netflixchromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"GeForce Now"* ]]; then # User selected GeForce Now - chromedirectory="\"$chrome_path\"" geforcechromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://play.geforcenow.com --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export geforcechromelaunchoptions=$geforcechromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Hulu"* ]]; then # User selected Hulu - chromedirectory="\"$chrome_path\"" huluchromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.hulu.com/welcome --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export huluchromelaunchoptions=$huluchromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Disney+"* ]]; then # User selected Disney+ - chromedirectory="\"$chrome_path\"" disneychromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.disneyplus.com --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export disneychromelaunchoptions=$disneychromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Amazon Prime Video"* ]]; then # User selected Amazon Prime Video - chromedirectory="\"$chrome_path\"" amazonchromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.amazon.com/primevideo --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export amazonchromelaunchoptions=$amazonchromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Youtube"* ]]; then # User selected Youtube - chromedirectory="\"$chrome_path\"" youtubechromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.youtube.com --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export youtubechromelaunchoptions=$youtubechromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Amazon Luna"* ]]; then # User selected Amazon Luna - chromedirectory="\"$chrome_path\"" lunachromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://luna.amazon.com/ --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export lunachromelaunchoptions=$lunachromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"Twitch"* ]]; then # User selected Twitch - chromedirectory="\"$chrome_path\"" twitchchromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://www.twitch.tv/ --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export twitchhromelaunchoptions=$twitchchromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi if [[ $options == *"movie-web"* ]]; then # User selected movie-web - chromedirectory="\"$chrome_path\"" moviewebchromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://movie-web.app/ --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" + echo "export moviewebchromelaunchoptions=$moviewebchromelaunchoptions" >> ${logged_in_home}/.config/systemd/user/env_vars fi @@ -2463,8 +2550,6 @@ fi # Check if any custom websites were provided if [ ${#custom_websites[@]} -gt 0 ]; then # User entered one or more custom websites - # Set the chromedirectory variable - chromedirectory="\"$chrome_path\"" # Convert the custom_websites array to a string custom_websites_str=$(IFS=", "; echo "${custom_websites[*]}") @@ -2487,10 +2572,6 @@ if [ ${#custom_websites[@]} -gt 0 ]; then # Capitalize the first letter of the website name website_name="$(tr '[:lower:]' '[:upper:]' <<< "${website_name:0:1}")${website_name:1}" - - # TODO: `chromelaunchoptions` is unused (SC2034) - # Set the chromelaunchoptions variable for this website - chromelaunchoptions="run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ --window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 --kiosk https://$clean_website/ --chrome-kiosk-type=fullscreen --no-first-run --enable-features=OverlayScrollbar" done fi From 3f9ec86f019e1a7eaca3bbe17acb392a9b5fb4fd Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:16:11 +0000 Subject: [PATCH 12/16] Add files via upload --- NSLGameScanner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 536ecd2..1518417 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -589,7 +589,7 @@ else: launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ubisoft_connect_launcher}/\" %command% \"uplay://launch/{uplay_id}/0\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ubisoft_connect_launcher}/pfx/drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher/upc.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ubisoft_connect_launcher}/pfx/drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher/\"" - create_new_entry(exe_path, game_name, launch_options, start_dir) + create_new_entry(exe_path, game, launch_options, start_dir) # End of Ubisoft Game Scanner @@ -633,7 +633,7 @@ else: launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ea_app_launcher}/\" %command% \"origin2://game/launch?offerIds={ea_ids}\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ea_app_launcher}/pfx/drive_c/Program Files/Electronic Arts/EA Desktop/EA Desktop/EALaunchHelper.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{ea_app_launcher}/pfx/drive_c/Program Files/Electronic Arts/EA Desktop/EA Desktop/\"" - create_new_entry(exe_path, game_name, launch_options, start_dir) + create_new_entry(exe_path, game, launch_options, start_dir) #End of EA App Scanner From b0f68b1e62eaf7e01e2f4c6d301ef9338b0b306a Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:33:37 +0000 Subject: [PATCH 13/16] Update NSLGameScanner.py --- NSLGameScanner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 1518417..a7f2cf2 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -502,7 +502,10 @@ if os.path.exists(os.path.join(compatdata_dir, 'NonSteamLaunchers')): # Print the existing shortcuts print("Existing Shortcuts:") for shortcut in shortcuts['shortcuts'].values(): - print(f"AppID for {shortcut.get('appname')}: {shortcut.get('appid')}") + if appname is None: + print(f"AppID for {shortcut.get('AppName')}: {shortcut.get('appid')}") + else: + print(f"AppID for {shortcut.get('appname')}: {shortcut.get('appid')}") From ff025f082a2d7c61e3b97c248de826420164f36c Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:36:35 +0000 Subject: [PATCH 14/16] Update NonSteamLaunchers.sh --- NonSteamLaunchers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index f2cc24a..0da432b 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -223,8 +223,6 @@ vkplay_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/VKPlayLa chrome_path="/usr/bin/flatpak" chrome_startdir="\"/usr/bin\"" chromedirectory="\"$chrome_path\"" -echo "export chromedirectory=$chromedirectory" >> ${logged_in_home}/.config/systemd/user/env_vars -echo "export chrome_startdir=$chrome_startdir" >> ${logged_in_home}/.config/systemd/user/env_vars # Check if Epic Games Launcher is installed function CheckInstallations { @@ -2157,6 +2155,8 @@ if [[ $options == *"Netflix"* ]] || [[ $options == *"Xbox Game Pass"* ]] || [[ $ # Run the flatpak --user override command flatpak --user override --filesystem=/run/udev:ro com.google.Chrome + echo "export chromedirectory=$chromedirectory" >> ${logged_in_home}/.config/systemd/user/env_vars + echo "export chrome_startdir=$chrome_startdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi fi From b94598f8de42e2ce6fee80361fc98da94f602b2c Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:41:38 +0000 Subject: [PATCH 15/16] Update NonSteamLaunchers.sh --- NonSteamLaunchers.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 0da432b..1ab5daa 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -2155,8 +2155,6 @@ if [[ $options == *"Netflix"* ]] || [[ $options == *"Xbox Game Pass"* ]] || [[ $ # Run the flatpak --user override command flatpak --user override --filesystem=/run/udev:ro com.google.Chrome - echo "export chromedirectory=$chromedirectory" >> ${logged_in_home}/.config/systemd/user/env_vars - echo "export chrome_startdir=$chrome_startdir" >> ${logged_in_home}/.config/systemd/user/env_vars fi fi @@ -2719,7 +2717,8 @@ echo "export steamid3=$steamid3" >> ${logged_in_home}/.config/systemd/user/env_v echo "export logged_in_home=$logged_in_home" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export compat_tool_name=$compat_tool_name" >> ${logged_in_home}/.config/systemd/user/env_vars echo "export python_version=$python_version" >> ${logged_in_home}/.config/systemd/user/env_vars - +echo "export chromedirectory=$chromedirectory" >> ${logged_in_home}/.config/systemd/user/env_vars +echo "export chrome_startdir=$chrome_startdir" >> ${logged_in_home}/.config/systemd/user/env_vars # Detach script from Steam process nohup sh -c 'sleep 10; /usr/bin/steam' & From c84fe7858ec0363a4b72fd3af0014a41c1c05467 Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:45:03 +0000 Subject: [PATCH 16/16] Update NSLGameScanner.py --- NSLGameScanner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index a7f2cf2..7702f2f 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -502,7 +502,7 @@ if os.path.exists(os.path.join(compatdata_dir, 'NonSteamLaunchers')): # Print the existing shortcuts print("Existing Shortcuts:") for shortcut in shortcuts['shortcuts'].values(): - if appname is None: + if shortcut.get('appname') is None: print(f"AppID for {shortcut.get('AppName')}: {shortcut.get('appid')}") else: print(f"AppID for {shortcut.get('appname')}: {shortcut.get('appid')}")