mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2024-11-20 16:19:19 +01:00
Reverted
This commit is contained in:
parent
b2e126ac1e
commit
4d5aede5ea
@ -2731,9 +2731,6 @@ if [ ${#custom_websites[@]} -gt 0 ]; then
|
|||||||
# Convert the custom_websites array to a string
|
# Convert the custom_websites array to a string
|
||||||
custom_websites_str=$(IFS=", "; echo "${custom_websites[*]}")
|
custom_websites_str=$(IFS=", "; echo "${custom_websites[*]}")
|
||||||
|
|
||||||
# Initialize an associative array to keep track of the number of entries for each base URL
|
|
||||||
declare -A base_url_counts
|
|
||||||
|
|
||||||
# Iterate over each custom website
|
# Iterate over each custom website
|
||||||
for custom_website in "${custom_websites[@]}"; do
|
for custom_website in "${custom_websites[@]}"; do
|
||||||
# Remove any leading or trailing spaces from the custom website URL
|
# Remove any leading or trailing spaces from the custom website URL
|
||||||
@ -2753,16 +2750,6 @@ if [ ${#custom_websites[@]} -gt 0 ]; then
|
|||||||
# Capitalize the first letter of the website name
|
# Capitalize the first letter of the website name
|
||||||
website_name="$(tr '[:lower:]' '[:upper:]' <<< "${website_name:0:1}")${website_name:1}"
|
website_name="$(tr '[:lower:]' '[:upper:]' <<< "${website_name:0:1}")${website_name:1}"
|
||||||
|
|
||||||
# Check if an entry has already been created for this base URL
|
|
||||||
if [[ ${base_url_counts[$website_name]} ]]; then
|
|
||||||
# An entry has already been created for this base URL, so increment the count and append it to the website name
|
|
||||||
((base_url_counts[$website_name]++))
|
|
||||||
website_name="${website_name} ${base_url_counts[$website_name]}"
|
|
||||||
else
|
|
||||||
# This is the first entry for this base URL, so initialize the count to 1
|
|
||||||
base_url_counts[$website_name]=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set the chromelaunchoptions variable for this website
|
# 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"
|
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
|
done
|
||||||
@ -3034,75 +3021,62 @@ def get_steam_shortcut_id(exe, appname):
|
|||||||
|
|
||||||
|
|
||||||
def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir):
|
def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir):
|
||||||
# Load the contents of the shortcuts.vdf file into a dictionary
|
if shortcutdirectory != '' and launchoptions != '':
|
||||||
with open('$shortcuts_vdf_path', 'rb') as f:
|
exe = f'"{shortcutdirectory}"'
|
||||||
existing_shortcuts = vdf.binary_load(f)
|
if shortcutdirectory != chromedirectory:
|
||||||
|
appid = get_steam_shortcut_id(exe, appname)
|
||||||
|
app_ids.append(appid)
|
||||||
|
else:
|
||||||
|
appid = None
|
||||||
|
|
||||||
# Check if an entry with the same appname and exe values already exists
|
# Create a new entry for the Steam shortcut
|
||||||
entry_exists = False
|
new_entry = {
|
||||||
for entry in existing_shortcuts['shortcuts']:
|
'appid': f'{str(appid)}' if appid is not None else '',
|
||||||
if entry['appname'] == appname and entry['exe'] == shortcutdirectory:
|
'appname': appname,
|
||||||
entry_exists = True
|
'exe': shortcutdirectory,
|
||||||
break
|
'StartDir': startingdir,
|
||||||
|
'icon': '',
|
||||||
# Only create a new entry if an existing entry was not found
|
'ShortcutPath': '',
|
||||||
if not entry_exists:
|
'LaunchOptions': launchoptions,
|
||||||
if shortcutdirectory != '' and launchoptions != '':
|
'IsHidden': 0,
|
||||||
exe = f'"{shortcutdirectory}"'
|
'AllowDesktopConfig': 1,
|
||||||
if shortcutdirectory != chromedirectory:
|
'AllowOverlay': 1,
|
||||||
appid = get_steam_shortcut_id(exe, appname)
|
'OpenVR': 0,
|
||||||
app_ids.append(appid)
|
'Devkit': 0,
|
||||||
else:
|
'DevkitGameID': '',
|
||||||
appid = None
|
'LastPlayTime': 0,
|
||||||
|
'tags': {
|
||||||
# Create a new entry for the Steam shortcut
|
'0': 'favorite'
|
||||||
new_entry = {
|
|
||||||
'appid': f'{str(appid)}' if appid is not None else '',
|
|
||||||
'appname': appname,
|
|
||||||
'exe': shortcutdirectory,
|
|
||||||
'StartDir': startingdir,
|
|
||||||
'icon': '',
|
|
||||||
'ShortcutPath': '',
|
|
||||||
'LaunchOptions': launchoptions,
|
|
||||||
'IsHidden': 0,
|
|
||||||
'AllowDesktopConfig': 1,
|
|
||||||
'AllowOverlay': 1,
|
|
||||||
'OpenVR': 0,
|
|
||||||
'Devkit': 0,
|
|
||||||
'DevkitGameID': '',
|
|
||||||
'LastPlayTime': 0,
|
|
||||||
'tags': {
|
|
||||||
'0': 'favorite'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Add the new entry to the shortcuts dictionary
|
# Add the new entry to the shortcuts dictionary
|
||||||
entry_exists = False
|
entry_exists = False
|
||||||
if type(shortcuts['shortcuts']) == list:
|
if type(shortcuts['shortcuts']) == list:
|
||||||
for entry in shortcuts['shortcuts']:
|
for entry in shortcuts['shortcuts']:
|
||||||
entry.setdefault('appname', '')
|
entry.setdefault('appname', '')
|
||||||
entry.setdefault('exe', '')
|
entry.setdefault('exe', '')
|
||||||
if entry['appname'] == new_entry['appname'] and entry['exe'] == new_entry['exe']:
|
if entry['appname'] == new_entry['appname'] and entry['exe'] == new_entry['exe']:
|
||||||
entry_exists = True
|
entry_exists = True
|
||||||
break
|
break
|
||||||
if not entry_exists:
|
if not entry_exists:
|
||||||
shortcuts['shortcuts'].append(new_entry)
|
shortcuts['shortcuts'].append(new_entry)
|
||||||
elif type(shortcuts['shortcuts']) == dict:
|
elif type(shortcuts['shortcuts']) == dict:
|
||||||
for key in shortcuts['shortcuts'].keys():
|
for key in shortcuts['shortcuts'].keys():
|
||||||
shortcuts['shortcuts'][key].setdefault('appname', '')
|
shortcuts['shortcuts'][key].setdefault('appname', '')
|
||||||
shortcuts['shortcuts'][key].setdefault('exe', '')
|
shortcuts['shortcuts'][key].setdefault('exe', '')
|
||||||
if shortcuts['shortcuts'][key]['appname'] == new_entry['appname'] and shortcuts['shortcuts'][key]['exe'] == new_entry['exe']:
|
if shortcuts['shortcuts'][key]['appname'] == new_entry['appname'] and shortcuts['shortcuts'][key]['exe'] == new_entry['exe']:
|
||||||
entry_exists = True
|
entry_exists = True
|
||||||
break
|
break
|
||||||
if not entry_exists:
|
if not entry_exists:
|
||||||
# Check if the shortcuts['shortcuts'] dictionary is empty
|
# Check if the shortcuts['shortcuts'] dictionary is empty
|
||||||
if not shortcuts['shortcuts']:
|
if not shortcuts['shortcuts']:
|
||||||
max_key = -1
|
max_key = -1
|
||||||
else:
|
else:
|
||||||
# Find the highest key value
|
# Find the highest key value
|
||||||
max_key = max(int(key) for key in shortcuts['shortcuts'].keys())
|
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
|
# Add the new entry with a key value one higher than the current maximum
|
||||||
shortcuts['shortcuts'][str(max_key + 1)] = new_entry
|
shortcuts['shortcuts'][str(max_key + 1)] = new_entry
|
||||||
|
|
||||||
create_new_entry('$epicshortcutdirectory', 'Epic Games', '$epiclaunchoptions', '$epicstartingdir')
|
create_new_entry('$epicshortcutdirectory', 'Epic Games', '$epiclaunchoptions', '$epicstartingdir')
|
||||||
create_new_entry('$gogshortcutdirectory', 'Gog Galaxy', '$goglaunchoptions', '$gogstartingdir')
|
create_new_entry('$gogshortcutdirectory', 'Gog Galaxy', '$goglaunchoptions', '$gogstartingdir')
|
||||||
|
Loading…
Reference in New Issue
Block a user