mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2024-12-21 23:31:52 +01:00
Python Changes for Websites and Shortcuts
~fixed duplicates from being made when script is ran multiple times ~fixed websites to allow multiple "base url" creations
This commit is contained in:
parent
df1dc5a4ce
commit
b2e126ac1e
@ -2731,6 +2731,9 @@ 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
|
||||||
@ -2750,6 +2753,16 @@ 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
|
||||||
@ -3021,6 +3034,19 @@ 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
|
||||||
|
with open('$shortcuts_vdf_path', 'rb') as f:
|
||||||
|
existing_shortcuts = vdf.binary_load(f)
|
||||||
|
|
||||||
|
# Check if an entry with the same appname and exe values already exists
|
||||||
|
entry_exists = False
|
||||||
|
for entry in existing_shortcuts['shortcuts']:
|
||||||
|
if entry['appname'] == appname and entry['exe'] == shortcutdirectory:
|
||||||
|
entry_exists = True
|
||||||
|
break
|
||||||
|
|
||||||
|
# Only create a new entry if an existing entry was not found
|
||||||
|
if not entry_exists:
|
||||||
if shortcutdirectory != '' and launchoptions != '':
|
if shortcutdirectory != '' and launchoptions != '':
|
||||||
exe = f'"{shortcutdirectory}"'
|
exe = f'"{shortcutdirectory}"'
|
||||||
if shortcutdirectory != chromedirectory:
|
if shortcutdirectory != chromedirectory:
|
||||||
|
Loading…
Reference in New Issue
Block a user