-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
NonSteamLaunchers.sh
executable file
·2513 lines (2017 loc) · 113 KB
/
NonSteamLaunchers.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
set -x # activate debugging (execution shown)
set -o pipefail # capture error from pipes
# set -eu # exit immediately, undefined vars are errors
# ENVIRONMENT VARIABLES
# $USER
logged_in_user=$(logname 2>/dev/null || whoami)
# DBUS
# Add the DBUS_SESSION_BUS_ADDRESS environment variable
if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then
eval $(dbus-launch --sh-syntax)
export DBUS_SESSION_BUS_ADDRESS
fi
export LD_LIBRARY_PATH=$(pwd)
# $UID
logged_in_uid=$(id -u "${logged_in_user}")
# $HOME
logged_in_home=$(eval echo "~${logged_in_user}")
# Debugging: Check the value of the DBUS_SESSION_BUS_ADDRESS environment variable
zenity --info --text="DBus session address: $DBUS_SESSION_BUS_ADDRESS" --no-session-bus
#Log
download_dir=$(eval echo ~$user)/Downloads/NonSteamLaunchersInstallation
log_file=$(eval echo ~$user)/Downloads/NonSteamLaunchers-install.log
# Remove existing log file if it exists
if [[ -f $log_file ]]; then
rm $log_file
fi
# Redirect all output to the log file
exec > >(tee -a $log_file) 2>&1
# Version number (major.minor)
version=v3.9.7
# TODO: tighten logic to check whether major/minor version is up-to-date via `-eq`, `-lt`, or `-gt` operators
# Check repo releases via GitHub API then display current stable version
check_for_updates() {
# Set the URL to the GitHub API for the repository
local api_url="https://api.github.com/repos/moraroy/NonSteamLaunchers-On-Steam-Deck/releases/latest"
# Get the latest release tag from the GitHub API
local latest_version=$(curl -s "$api_url" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Compare the version number in the script against the latest release tag
if [ "$version" != "$latest_version" ]; then
# Display a Zenity window to notify the user that a new version is available
zenity --info --text="A new version is available: $latest_version\nPlease download it from GitHub." --width=200 --height=100 --timeout=5
else
echo "You are already running the latest version: $version"
fi
}
# Get the command line arguments
args=("$@")
deckyplugin=false
installchrome=false
for arg in "${args[@]}"; do
if [ "$arg" = "DeckyPlugin" ]; then
deckyplugin=true
elif [ "$arg" = "Chrome" ]; then
installchrome=true
fi
done
# Check if the user wants to install Chrome
if $installchrome; then
# Check if Google Chrome is already installed for the current user
if flatpak list --user | grep com.google.Chrome &> /dev/null; then
echo "Google Chrome is already installed for the current user"
flatpak --user override --filesystem=/run/udev:ro com.google.Chrome
else
# Check if the Flathub repository exists for the current user
if flatpak remote-list --user | grep flathub &> /dev/null; then
echo "Flathub repository exists for the current user"
else
# Add the Flathub repository for the current user
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
# Install Google Chrome for the current user
flatpak install --user flathub com.google.Chrome -y
# Run the flatpak --user override command
flatpak --user override --filesystem=/run/udev:ro com.google.Chrome
fi
fi
if [ "${deckyplugin}" = false ]; then
#Download Modules
# Define the repository and the folders to clone
repo_url='https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck/archive/refs/heads/main.zip'
folders_to_clone=('requests' 'urllib3' 'steamgrid' 'vdf' 'charset_normalizer')
# Define the parent folder
logged_in_home=$(eval echo ~$user)
parent_folder="${logged_in_home}/.config/systemd/user/Modules"
mkdir -p "${parent_folder}"
# Check if the folders already exist
folders_exist=true
for folder in "${folders_to_clone[@]}"; do
if [ ! -d "${parent_folder}/${folder}" ]; then
folders_exist=false
break
fi
done
if [ "${folders_exist}" = false ]; then
# Download the repository as a zip file
zip_file_path="${parent_folder}/repo.zip"
wget -O "${zip_file_path}" "${repo_url}" || { echo 'Download failed with error code: $?'; exit 1; }
# Extract the zip file
unzip -d "${parent_folder}" "${zip_file_path}" || { echo 'Unzip failed with error code: $?'; exit 1; }
# Move the folders to the parent directory and delete the unnecessary files
for folder in "${folders_to_clone[@]}"; do
destination_path="${parent_folder}/${folder}"
source_path="${parent_folder}/NonSteamLaunchers-On-Steam-Deck-main/Modules/${folder}"
if [ ! -d "${destination_path}" ]; then
mv "${source_path}" "${destination_path}" || { echo 'Move failed with error code: $?'; exit 1; }
fi
done
# Delete the downloaded zip file and the extracted repository folder
rm "${zip_file_path}"
rm -r "${parent_folder}/NonSteamLaunchers-On-Steam-Deck-main"
fi
#End of Download Modules
#Service File rough update
rm -rf ${logged_in_home}/.config/systemd/user/NSLGameScanner.py
# Delete the service file
rm -rf ${logged_in_home}/.config/systemd/user/nslgamescanner.service
# Remove the symlink
unlink ${logged_in_home}/.config/systemd/user/default.target.wants/nslgamescanner.service
# Reload the systemd user instance
systemctl --user daemon-reload
# Define your Python script path
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"
curl -o $python_script_path $github_link
# Define the path to the env_vars file
env_vars="${logged_in_home}/.config/systemd/user/env_vars"
#End of Rough Update of the .py
if [ -f "$env_vars" ]; then
echo "env_vars file found. Running the .py file."
live="and is LIVE."
else
echo "env_vars file not found. Not Running the .py file."
live="and is not LIVE."
fi
# Check if "Decky Plugin" is one of the arguments
decky_plugin=false
for arg in "${args[@]}"; do
if [ "$arg" = "Decky Plugin" ]; then
decky_plugin=true
break
fi
done
# If the Decky Plugin argument is set, check if the env_vars file exists
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
echo "Python script ran. Continuing with the script..."
else
# If the env_vars file does not exist, exit the script
echo "Decky Plugin argument set but env_vars file not found. Exiting the script."
exit 0
fi
else
# If the Decky Plugin argument is not set, continue with the script
echo "Decky Plugin argument not set. Continuing with the script..."
python3 $python_script_path
echo "env_vars file found. Running the .py file."
live="and is LIVE."
fi
fi
# Check if any command line arguments were provided
if [ ${#args[@]} -eq 0 ]; then
# No command line arguments were provided, so check for updates and display the zenity window if necessary
check_for_updates
fi
# Check if the NonSteamLaunchersInstallation subfolder exists in the Downloads folder
if [ -d "$download_dir" ]; then
# Delete the NonSteamLaunchersInstallation subfolder
rm -rf "$download_dir"
echo "Deleted NonSteamLaunchersInstallation subfolder"
else
echo "NonSteamLaunchersInstallation subfolder does not exist"
fi
# Game Launchers
# TODO: parameterize hard-coded client versions (cf. 'app-26.1.9')
# Set the paths to the launcher executables
epic_games_launcher_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/Epic Games/Launcher/Portal/Binaries/Win32/EpicGamesLauncher.exe"
epic_games_launcher_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/EpicGamesLauncher/pfx/drive_c/Program Files (x86)/Epic Games/Launcher/Portal/Binaries/Win32/EpicGamesLauncher.exe"
gog_galaxy_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe"
gog_galaxy_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/GogGalaxyLauncher/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe"
uplay_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher/upc.exe"
uplay_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/UplayLauncher/pfx/drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher/upc.exe"
battlenet_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe"
battlenet_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/Battle.netLauncher/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe"
eaapp_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Electronic Arts/EA Desktop/EA Desktop/EADesktop.exe"
eaapp_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/pfx/drive_c/Program Files/Electronic Arts/EA Desktop/EA Desktop/EADesktop.exe"
amazongames_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/users/steamuser/AppData/Local/Amazon Games/App/Amazon Games.exe"
amazongames_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/AmazonGamesLauncher/pfx/drive_c/users/steamuser/AppData/Local/Amazon Games/App/Amazon Games.exe"
itchio_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/users/steamuser/AppData/Local/itch/app-26.1.9/itch.exe"
itchio_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/itchioLauncher/pfx/drive_c/users/steamuser/AppData/Local/itch/app-26.1.9/itch.exe"
legacygames_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Legacy Games/Legacy Games Launcher/Legacy Games Launcher.exe"
legacygames_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/LegacyGamesLauncher/pfx/drive_c/Program Files/Legacy Games/Legacy Games Launcher/Legacy Games Launcher.exe"
humblegames_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Humble App/Humble App.exe"
humblegames_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/HumbleGamesLauncher/pfx/drive_c/Program Files/Humble App/Humble App.exe"
indiegala_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/IGClient/IGClient.exe"
indiegala_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/IndieGalaLauncher/pfx/drive_c/Program Files/IGClient/IGClient.exe"
rockstar_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Rockstar Games/Launcher/Launcher.exe"
rockstar_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/RockstarGamesLauncher/pfx/drive_c/Program Files/Rockstar Games/Launcher/Launcher.exe"
glyph_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/Glyph/GlyphClient.exe"
glyph_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/GlyphLauncher/pfx/drive_c/Program Files (x86)/Glyph/GlyphClient.exe"
psplus_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/PlayStationPlus/pspluslauncher.exe"
psplus_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/PlaystationPlusLauncher/pfx/drive_c/Program Files (x86)/PlayStationPlus/pspluslauncher.exe"
vkplay_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/users/steamuser/AppData/Local/GameCenter/GameCenter.exe"
vkplay_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/VKPlayLauncher/pfx/drive_c/users/steamuser/AppData/Local/GameCenter/GameCenter.exe"
hoyoplay_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/HoYoPlay/launcher.exe"
hoyoplay_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/HoYoPlayLauncher/pfx/drive_c/Program Files/HoYoPlay/launcher.exe"
nexon_path1="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/Nexon/Nexon Launcher/nexon_launcher.exe"
nexon_path2="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NexonLauncher/pfx/drive_c/Program Files (x86)/Nexon/Nexon Launcher/nexon_launcher.exe"
# Chrome File Path
# chrome_installpath="/app/bin/chrome"
chrome_path="/usr/bin/flatpak"
chrome_startdir="\"/usr/bin\""
chromedirectory="\"$chrome_path\""
#Zenity Launcher Check Installation
function CheckInstallations {
declare -A paths1 paths2 names
paths1=(["epic_games"]="$epic_games_launcher_path1" ["gog_galaxy"]="$gog_galaxy_path1" ["uplay"]="$uplay_path1" ["battlenet"]="$battlenet_path1" ["eaapp"]="$eaapp_path1" ["amazongames"]="$amazongames_path1" ["itchio"]="$itchio_path1" ["legacygames"]="$legacygames_path1" ["humblegames"]="$humblegames_path1" ["indiegala"]="$indiegala_path1" ["rockstar"]="$rockstar_path1" ["glyph"]="$glyph_path1" ["psplus"]="$psplus_path1" ["vkplay"]="$vkplay_path1" ["hoyoplay"]=$hoyoplay_path1 ["nexon"]=$nexon_path1)
paths2=(["epic_games"]="$epic_games_launcher_path2" ["gog_galaxy"]="$gog_galaxy_path2" ["uplay"]="$uplay_path2" ["battlenet"]="$battlenet_path2" ["eaapp"]="$eaapp_path2" ["amazongames"]="$amazongames_path2" ["itchio"]="$itchio_path2" ["legacygames"]="$legacygames_path2" ["humblegames"]="$humblegames_path2" ["indiegala"]="$indiegala_path2" ["rockstar"]="$rockstar_path2" ["glyph"]="$glyph_path2" ["psplus"]="$psplus_path2" ["vkplay"]="$vkplay_path2" ["hoyoplay"]=$hoyoplay_path2 ["nexon"]=$nexon_path2)
names=(["epic_games"]="Epic Games" ["gog_galaxy"]="GOG Galaxy" ["uplay"]="Ubisoft Connect" ["battlenet"]="Battle.net" ["eaapp"]="EA App" ["amazongames"]="Amazon Games" ["itchio"]="itch.io" ["legacygames"]="Legacy Games" ["humblegames"]="Humble Games Collection" ["indiegala"]="IndieGala" ["rockstar"]="Rockstar Games Launcher" ["glyph"]="Glyph Launcher" ["psplus"]="Playstation Plus" ["vkplay"]="VK Play" ["hoyoplay"]="HoYoPlay" ["nexon"]="Nexon Launcher")
for launcher in "${!names[@]}"; do
if [[ -f "${paths1[$launcher]}" ]]; then
declare -g "${launcher}_value"="FALSE"
declare -g "${launcher}_text"="${names[$launcher]} ===> ${paths1[$launcher]}"
elif [[ -f "${paths2[$launcher]}" ]]; then
declare -g "${launcher}_value"="FALSE"
declare -g "${launcher}_text"="${names[$launcher]} ===> ${paths2[$launcher]}"
else
declare -g "${launcher}_value"="FALSE"
declare -g "${launcher}_text"="${names[$launcher]}"
fi
done
}
# Verify launchers are installed
function CheckInstallationDirectory {
declare -A paths names
paths=(["nonsteamlauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers" ["epicgameslauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/EpicGamesLauncher" ["goggalaxylauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/GogGalaxyLauncher" ["uplaylauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/UplayLauncher" ["battlenetlauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/Battle.netLauncher" ["eaapplauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher" ["amazongameslauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/AmazonGamesLauncher" ["itchiolauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/itchioLauncher" ["legacygameslauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/LegacyGamesLauncher" ["humblegameslauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/HumbleGamesLauncher" ["indiegalalauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/IndieGalaLauncher" ["rockstargameslauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/RockstarGamesLauncher" ["glyphlauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/GlyphLauncher" ["pspluslauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/PlaystationPlusLauncher" ["vkplaylauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/VKPlayLauncher" ["hoyoplaylauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/HoYoPlayLauncher" ["nexonlauncher"]="${logged_in_home}/.local/share/Steam/steamapps/compatdata/NexonLauncher")
names=(["nonsteamlauncher"]="NonSteamLaunchers" ["epicgameslauncher"]="EpicGamesLauncher" ["goggalaxylauncher"]="GogGalaxyLauncher" ["uplaylauncher"]="UplayLauncher" ["battlenetlauncher"]="Battle.netLauncher" ["eaapplauncher"]="TheEAappLauncher" ["amazongameslauncher"]="AmazonGamesLauncher" ["itchiolauncher"]="itchioLauncher" ["legacygameslauncher"]="LegacyGamesLauncher" ["humblegameslauncher"]="HumbleGamesLauncher" ["indiegalalauncher"]="IndieGalaLauncher" ["rockstargameslauncher"]="RockstarGamesLauncher" ["glyphlauncher"]="GlyphLauncher" ["pspluslauncher"]="PlaystationPlusLauncher" ["vkplaylauncher"]="VKPlayLauncher" ["hoyoplaylauncher"]="HoYoPlayLauncher" ["nexonlauncher"]="NexonLauncher")
for launcher in "${!names[@]}"; do
if [[ -d "${paths[$launcher]}" ]]; then
declare -g "${launcher}_move_value"="TRUE"
else
declare -g "${launcher}_move_value"="FALSE"
fi
done
}
#Get SD Card Path
get_sd_path() {
# This assumes that the SD card is mounted under /run/media/deck/
local sd_path=$(df | grep '/run/media/deck/' | awk '{print $6}')
echo $sd_path
}
# Function For Updating Proton-GE
function download_ge_proton() {
echo "Downloading GE-Proton using the GitHub API"
cd "${logged_in_home}/Downloads/NonSteamLaunchersInstallation" || { echo "Failed to change directory. Exiting."; exit 1; }
# Download tarball
tarball_url=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep browser_download_url | cut -d\" -f4 | grep .tar.gz)
if [ -z "$tarball_url" ]; then
echo "Failed to get tarball URL. Exiting."
exit 1
fi
curl --retry 5 --retry-delay 0 --retry-max-time 60 -sLOJ "$tarball_url"
if [ $? -ne 0 ]; then
echo "Curl failed to download tarball. Exiting."
exit 1
fi
# Download checksum
checksum_url=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep browser_download_url | cut -d\" -f4 | grep .sha512sum)
if [ -z "$checksum_url" ]; then
echo "Failed to get checksum URL. Exiting."
exit 1
fi
curl --retry 5 --retry-delay 0 --retry-max-time 60 -sLOJ "$checksum_url"
if [ $? -ne 0 ]; then
echo "Curl failed to download checksum. Exiting."
exit 1
fi
# Verify checksum
sha512sum -c ./*.sha512sum
if [ $? -ne 0 ]; then
echo "Checksum verification failed. Exiting."
exit 1
fi
# Extract tarball
tar -xf GE-Proton*.tar.gz -C "${logged_in_home}/.steam/root/compatibilitytools.d/"
if [ $? -ne 0 ]; then
echo "Tar extraction failed. Exiting."
exit 1
fi
proton_dir=$(find -L "${logged_in_home}/.steam/root/compatibilitytools.d" -maxdepth 1 -type d -name "GE-Proton*" | sort -V | tail -n1)
echo "All done :)"
}
function update_proton() {
echo "0"
echo "# Detecting, Updating and Installing GE-Proton...please wait..."
# Check if compatibilitytools.d exists and create it if it doesn't
if [ ! -d "${logged_in_home}/.steam/root/compatibilitytools.d" ]; then
mkdir -p "${logged_in_home}/.steam/root/compatibilitytools.d" || { echo "Failed to create directory. Exiting."; exit 1; }
fi
# Create NonSteamLaunchersInstallation subfolder in Downloads folder
mkdir -p "${logged_in_home}/Downloads/NonSteamLaunchersInstallation" || { echo "Failed to create directory. Exiting."; exit 1; }
# Set the path to the Proton directory
proton_dir=$(find -L "${logged_in_home}/.steam/root/compatibilitytools.d" -maxdepth 1 -type d -name "GE-Proton*" | sort -V | tail -n1)
# Check if GE-Proton is installed
if [ -z "$proton_dir" ]; then
download_ge_proton
else
# Check if installed version is the latest version
installed_version=$(basename "$proton_dir" | sed 's/GE-Proton-//')
latest_version=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep tag_name | cut -d '"' -f 4)
if [ "$installed_version" != "$latest_version" ]; then
download_ge_proton
fi
fi
}
# Function For Updating UMU Launcher
function download_umu_launcher() {
echo "Downloading UMU Launcher using the GitHub API"
cd "${logged_in_home}/Downloads/NonSteamLaunchersInstallation" || { echo "Failed to change directory. Exiting."; exit 1; }
# Download zip file
zip_url=$(curl -s https://api.github.com/repos/Open-Wine-Components/umu-launcher/releases/latest | grep browser_download_url | cut -d\" -f4 | grep Zipapp.zip)
if [ -z "$zip_url" ]; then
echo "Failed to get zip URL. Exiting."
exit 1
fi
curl --retry 5 --retry-delay 0 --retry-max-time 60 -sLOJ "$zip_url"
if [ $? -ne 0 ]; then
echo "Curl failed to download zip file. Exiting."
exit 1
fi
# Ensure the bin directory exists
if [ ! -d "${logged_in_home}/bin" ]; then
mkdir -p "${logged_in_home}/bin" || { echo "Failed to create bin directory. Exiting."; exit 1; }
fi
# Extract zip file
unzip -o Zipapp.zip -d "${logged_in_home}/bin/"
if [ $? -ne 0 ]; then
echo "Zip extraction failed. Exiting."
exit 1
fi
# Make all extracted files executable
find "${logged_in_home}/bin/" -type f -exec chmod +x {} \;
echo "UMU Launcher update completed :)"
}
function update_umu_launcher() {
echo "0"
echo "# Detecting, Updating and Installing UMU Launcher...please wait..."
# Create NonSteamLaunchersInstallation subfolder in Downloads folder
mkdir -p "${logged_in_home}/Downloads/NonSteamLaunchersInstallation" || { echo "Failed to create directory. Exiting."; exit 1; }
# Set the path to the UMU Launcher directory
umu_dir="${logged_in_home}/bin/umu-launcher"
# Check if UMU Launcher is installed
if [ ! -d "$umu_dir" ]; then
download_umu_launcher
else
# Check if installed version is the latest version
installed_version=$(cat "$umu_dir/version.txt")
latest_version=$(curl -s https://api.github.com/repos/Open-Wine-Components/umu-launcher/releases/latest | grep tag_name | cut -d '"' -f 4)
if [ "$installed_version" != "$latest_version" ]; then
download_umu_launcher
fi
fi
}
# Check which app IDs are installed
CheckInstallations
CheckInstallationDirectory
rm -rf ${logged_in_home}/.config/systemd/user/nslgamescanner.service
unlink ${logged_in_home}/.config/systemd/user/default.target.wants/nslgamescanner.service
systemctl --user daemon-reload
# Get the command line arguments
args=("$@")
# Initialize an array to store the custom websites
custom_websites=()
# Initialize a variable to store whether the "Separate App IDs" option is selected or not
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 - 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" $psplus_value "$psplus_text" $vkplay_value "$vkplay_text" $hoyoplay_value "$hoyoplay_text" $nexon_value "$nexon_text" FALSE "RemotePlayWhatever" FALSE "Fortnite" FALSE "Xbox Game Pass" FALSE "GeForce Now" FALSE "Amazon Luna" FALSE "WebRcade" FALSE "WebRcade Editor" FALSE "Netflix" FALSE "Hulu" FALSE "Disney+" FALSE "Amazon Prime Video" FALSE "Youtube" FALSE "Twitch" FALSE "Apple TV+" FALSE "Crunchyroll" FALSE "Plex" --width=800 --height=740 --extra-button="Uninstall" --extra-button="Stop NSLGameScanner" --extra-button="Start Fresh" --extra-button="Move to SD Card" --extra-button="Update Proton-GE")
# 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" ]]; then
# The user clicked the 'Cancel' button or selected one of the extra buttons, so skip prompting for custom websites
custom_websites=()
else
# The user did not click the 'Cancel' button or select one of the extra buttons, so prompt for custom websites
custom_websites_str=$(zenity --entry --title="Shortcut Creator" --text="Enter custom websites that you want shortcuts for, separated by commas. Leave blank and press ok if you dont want any. E.g. myspace.com, limewire.com, my.screenname.aol.com")
# Split the custom_websites_str variable into an array using ',' as the delimiter
IFS=',' read -ra custom_websites <<< "$custom_websites_str"
fi
else
# Command line arguments were provided, so set the value of the options variable using the command line arguments
# Initialize an array to store the selected launchers
selected_launchers=()
IFS=" "
for arg in "${args[@]}"; do
if [[ "$arg" =~ ^https?:// ]]; then
website=${arg#https://}
# Check if the arg is not an empty string before adding it to the custom_websites array
if [ -n "$website" ]; then
custom_websites+=("$website")
fi
else
selected_launchers+=("$arg")
fi
done
# TODO: error handling for unbound variable $selected_launchers_str on line 564
# Convert the selected_launchers array to a string by joining its elements with a `|` delimiter.
selected_launchers_str=$(IFS="|"; echo "${selected_launchers[*]}")
# TODO: SC2199
# Check if the `SEPARATE APP IDS - CHECK THIS TO SEPARATE YOUR PREFIX` option was included in the `selected_launchers` variable. If this option was included, set the value of the `separate_app_ids` variable to `true`, indicating that separate app IDs should be used. Otherwise, set it to `false`.
if [[ "${selected_launchers[@]}" =~ "SEPARATE APP IDS - CHECK THIS TO SEPARATE YOUR PREFIX" ]]; then
separate_app_ids=true
else
separate_app_ids=false
fi
fi
# TODO: SC2145
# Print the selected launchers and custom websites
echo "Selected launchers: $selected_launchers"
echo "Selected launchers: $selected_launchers_str"
echo "Custom websites: ${custom_websites[@]}"
echo "Separate App IDs: $separate_app_ids"
# Set the value of the options variable
if [ ${#args[@]} -eq 0 ]; then
# No command line arguments were provided, so set the value of the options variable using the selected_launchers variable
options="$selected_launchers"
else
# Command line arguments were provided, so set the value of the options variable using the selected_launchers_str variable
options="$selected_launchers_str"
fi
# Check if the cancel button was clicked
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
fi
# Check if no options were selected and no custom website was provided
if [ -z "$options" ] && [ -z "$custom_websites" ]; then
# No options were selected and no custom website was provided
zenity --error --text="No options were selected and no custom website was provided. The script will now exit." --width=200 --height=150 --timeout=5
exit 1
fi
# Check if the user selected to use separate app IDs
if [[ $options == *"SEPARATE APP IDS - CHECK THIS TO SEPARATE YOUR PREFIX"* ]]; then
# User selected to use separate app IDs
use_separate_appids=true
else
# User did not select to use separate app IDs
use_separate_appids=false
fi
# Define the StartFreshFunction
function StartFreshFunction {
# Define the path to the compatdata directory
compatdata_dir="${logged_in_home}/.local/share/Steam/steamapps/compatdata"
# Define the path to the other directory
other_dir="${logged_in_home}/.local/share/Steam/steamapps/shadercache/"
# Define an array of original folder names
folder_names=("EpicGamesLauncher" "GogGalaxyLauncher" "UplayLauncher" "Battle.netLauncher" "TheEAappLauncher" "AmazonGamesLauncher" "itchioLauncher" "LegacyGamesLauncher" "HumbleGamesLauncher" "IndieGalaLauncher" "RockstarGamesLauncher" "GlyphLauncher" "PlaystationPlusLauncher" "VKPlayLauncher" "HoYoPlayLauncher" "NexonLauncher")
# Define an array of app IDs
app_ids=("3772819390" "4294900670" "4063097571" "3786021133" "3448088735" "3923904787" "3440562512" "2948446662" "3908676077" "4206469918" "3303169468" "3595505624" "4272271078" "3259996605" "2588786779" "4090616647" "3494943831" "2390200925" "4253976432" "2221882453" "2296676888" "2486751858" "3974004104" "3811372789" "3788101956" "3782277090" "3640061468" "3216372511" "2882622939" "2800812206" "2580882702" "4022508926")
# Iterate over each folder name in the folder_names array
for folder in "${folder_names[@]}"; do
# Check if the folder exists
if [ -e "${compatdata_dir}/${folder}" ]; then
# Check if the folder is a symbolic link
if [ -L "${compatdata_dir}/${folder}" ]; then
# Get the path of the target of the symbolic link
target_path=$(readlink -f "${compatdata_dir}/${folder}")
# Delete the target of the symbolic link
rm -rf "$target_path"
# Delete the symbolic link
unlink "${compatdata_dir}/${folder}"
else
# Delete the folder
# shellcheck disable=SC2115
rm -rf "${compatdata_dir}/${folder}"
fi
fi
done
# Iterate over each app ID in the app_ids array
for app_id in "${app_ids[@]}"; do
# Check if the folder exists
if [ -e "${other_dir}/${app_id}" ]; then
# Check if the folder is a symbolic link
if [ -L "${other_dir}/${app_id}" ]; then
# Get the path of the target of the symbolic link
target_path=$(readlink -f "${other_dir}/${app_id}")
# Delete the target of the symbolic link
rm -rf "$target_path"
# Delete the symbolic link
unlink "${other_dir}/${app_id}"
else
# Delete the folder
# shellcheck disable=SC2115
rm -rf "${other_dir}/${app_id}"
fi
fi
done
# Check if the NonSteamLaunchers folder exists
if [ -e "$compatdata_dir/NonSteamLaunchers" ]; then
# Check if the NonSteamLaunchers folder is a symbolic link
if [ -L "$compatdata_dir/NonSteamLaunchers" ]; then
# Get the path of the target of the symbolic link
target_path=$(readlink -f "$compatdata_dir/NonSteamLaunchers")
# Delete the target of the symbolic link
rm -rf "$target_path"
# Delete the symbolic link
unlink "$compatdata_dir/NonSteamLaunchers"
else
# Delete the NonSteamLaunchers folder
rm -rf "$compatdata_dir/NonSteamLaunchers"
fi
fi
# Iterate over each folder in the compatdata directory
for folder_path in "$compatdata_dir"/*; do
# Check if the current item is a folder
if [ -d "$folder_path" ]; then
# Check if the folder is empty
if [ -z "$(ls -A "$folder_path")" ]; then
# Delete the empty folder
rmdir "$folder_path"
echo "Deleted empty folder: $(basename "$folder_path")"
fi
fi
done
# TODO: declare array and use find/for loop to avoid duplicate `rm` processes
rm -rf "/run/media/mmcblk0p1/NonSteamLaunchers/"
rm -rf "/run/media/mmcblk0p1/EpicGamesLauncher/"
rm -rf "/run/media/mmcblk0p1/GogGalaxyLauncher/"
rm -rf "/run/media/mmcblk0p1/UplayLauncher/"
rm -rf "/run/media/mmcblk0p1/Battle.netLauncher/"
rm -rf "/run/media/mmcblk0p1/TheEAappLauncher/"
rm -rf "/run/media/mmcblk0p1/AmazonGamesLauncher/"
rm -rf "/run/media/mmcblk0p1/LegacyGamesLauncher/"
rm -rf "/run/media/mmcblk0p1/itchioLauncher/"
rm -rf "/run/media/mmcblk0p1/HumbleGamesLauncher/"
rm -rf "/run/media/mmcblk0p1/IndieGalaLauncher/"
rm -rf "/run/media/mmcblk0p1/RockstarGamesLauncher/"
rm -rf "/run/media/mmcblk0p1/GlyphLauncher/"
rm -rf "/run/media/mmcblk0p1/PlaystationPlusLauncher/"
rm -rf "/run/media/mmcblk0p1/VKPlayLauncher/"
rm -rf "/run/media/mmcblk0p1/HoYoPlayLauncher/"
rm -rf "/run/media/mmcblk0p1/NexonLauncher/"
rm -rf ${logged_in_home}/Downloads/NonSteamLaunchersInstallation
rm -rf ${logged_in_home}/.config/systemd/user/Modules
rm -rf ${logged_in_home}/.config/systemd/user/env_vars
rm -rf ${logged_in_home}/.config/systemd/user/NSLGameScanner.py
rm -rf ${logged_in_home}/.local/share/applications/RemotePlayWhatever
rm -rf ${logged_in_home}/.local/share/applications/RemotePlayWhatever.desktop
rm -rf ${logged_in_home}/Downloads/NonSteamLaunchers-install.log
# Delete the service file
rm -rf ${logged_in_home}/.config/systemd/user/nslgamescanner.service
# Remove the symlink
unlink ${logged_in_home}/.config/systemd/user/default.target.wants/nslgamescanner.service
# Reload the systemd user instance
systemctl --user daemon-reload
# Exit the script with exit code 0 to indicate success
exit 0
}
# Check if the Start Fresh button was clicked or if the Start Fresh option was passed as a command line argument
if [[ $options == "Start Fresh" ]] || [[ $selected_launchers == "Start Fresh" ]]; then
# The Start Fresh button was clicked or the Start Fresh option was passed as a command line argument
if [ ${#args[@]} -eq 0 ]; then
# No command line arguments were provided, so display the zenity window
if zenity --question --text="aaahhh it always feels good to start fresh :) but...This will delete the App ID folders you installed inside the steamapps/compatdata/ directory as well as the Shader Cache associated with them in the steamapps/shadercache directory. The nslgamescanner.service will also be terminated at /.config/systemd/user/ This means anything youve installed (launchers or games) WITHIN THIS SCRIPT will be deleted if you have them there. Everything will be wiped. Are you sure?" --width=300 --height=260; then
# The user clicked the "Yes" button, so call the StartFreshFunction
StartFreshFunction
# If the Start Fresh function was called, set an environment variable
if [ "$?" -eq 0 ]; then
export START_FRESH=true
else
export START_FRESH=false
fi
else
# The user clicked the "No" button, so exit with exit code 0 to indicate success.
exit 0
fi
else
# Command line arguments were provided, so skip displaying the zenity window and directly perform any necessary actions to start fresh by calling the StartFreshFunction
StartFreshFunction
fi
fi
#Set Downloads INFO
echo "10"
echo "# Setting files in their place"
# Set the appid for the non-Steam game
appid=NonSteamLaunchers
# Set the URL to download the MSI file from
msi_url=https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncherInstaller.msi
# Set the path to save the MSI file to
msi_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/EpicGamesLauncherInstaller.msi
# Set the URL to download the second file from
exe_url=https://webinstallers.gog-statics.com/download/GOG_Galaxy_2.0.exe
# Set the path to save the second file to
exe_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/GOG_Galaxy_2.0.exe
# Set the URL to download the third file from
ubi_url=https://ubi.li/4vxt9
# Set the path to save the third file to
ubi_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/UbisoftConnectInstaller.exe
# Set the URL to download the fifth file from
battle_url="https://www.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live"
# Set the path to save the fifth file to
battle_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/Battle.net-Setup.exe
# Set the URL to download the sixth file from
amazon_url=https://download.amazongames.com/AmazonGamesSetup.exe
# Set the path to save the sixth file to
amazon_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/AmazonGamesSetup.exe
# Set the URL to download the seventh file from
eaapp_url=https://origin-a.akamaihd.net/EA-Desktop-Client-Download/installer-releases/EAappInstaller.exe
# Set the path to save the seventh file to
eaapp_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/EAappInstaller.exe
# Set the URL to download the eighth file from
itchio_url=https://itch.io/app/download?platform=windows
# Set the path to save the eighth file to
itchio_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/itch-setup.exe
# Set the URL to download the ninth file from
legacygames_url=https://cdn.legacygames.com/LegacyGamesLauncher/legacy-games-launcher-setup-1.10.0-x64-full.exe
# Set the path to save the ninth file to
legacygames_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/legacy-games-launcher-setup-1.10.0-x64-full.exe
# Set the URL to download the tenth file from
humblegames_url=https://www.humblebundle.com/app/download
# Set the path to save the tenth file to
humblegames_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/Humble-App-Setup-1.1.8+411.exe
# Set the URL to download the eleventh file from
indiegala_url=https://content.indiegalacdn.com/common/IGClientSetup.exe
# Set the path to save the eleventh file to
indiegala_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/IGClientSetup.exe
# Set the URL to download the twelfth file from
rockstar_url=https://gamedownloads.rockstargames.com/public/installer/Rockstar-Games-Launcher.exe
# Set the path to save the twelfth file to
rockstar_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/Rockstar-Games-Launcher.exe
# Set the URL to download the Glyph Launcher file from
glyph_url=https://glyph.dyn.triongames.com/glyph/live/GlyphInstall.exe
# Set the path to save the Glyph Launcher to
glyph_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/GlyphInstall.exe
# Set the URL to download the Playstation Launcher file from
psplus_url=https://download-psplus.playstation.com/downloads/psplus/pc/latest
# Set the path to save the Playstation Launcher to
psplus_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/PlayStationPlus-12.2.0.exe
# Set the URL to download the VK Play Launcher file from
vkplay_url=https://static.gc.vkplay.ru/VKPlayLoader.exe
# Set the path to save the VK Play Launcher to
vkplay_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/VKPlayLoader.exe
# Set the URL to download the Hoyo Play Play Launcher file from
hoyoplay_url="https://download-porter.hoyoverse.com/download-porter/2024/06/07/hyp_global_setup_1.0.5.exe"
# Set the path to save the Hoyo Play Launcher to
hoyoplay_file="${logged_in_home}/Downloads/NonSteamLaunchersInstallation/HoYoPlay_install.exe"
# Set the URL to download the Nexon Launcher file from
nexon_url="https://download.nxfs.nexon.com/download-launcher?file=NexonLauncherSetup.exe&client-id=959013368.1720525616"
# Set the path to save the Nexon Launcher to
nexon_file=${logged_in_home}/Downloads/NonSteamLaunchersInstallation/NexonLauncherSetup.exe
#End of Downloads INFO
# Function to handle common uninstallation tasks
handle_uninstall_common() {
compatdata_dir=$1
uninstaller_path=$2
uninstaller_options=$3
app_name=$4
# Set the path to the Proton directory
proton_dir=$(find -L "${logged_in_home}/.steam/root/compatibilitytools.d" -maxdepth 1 -type d -name "GE-Proton*" | sort -V | tail -n1)
# Set the paths for the environment variables
STEAM_RUNTIME="${logged_in_home}/.steam/root/ubuntu12_32/steam-runtime/run.sh"
STEAM_COMPAT_CLIENT_INSTALL_PATH="${logged_in_home}/.local/share/Steam"
STEAM_COMPAT_DATA_PATH="${logged_in_home}/.local/share/Steam/steamapps/compatdata/${compatdata_dir}"
# Export the STEAM_COMPAT_DATA_PATH variable
export STEAM_COMPAT_DATA_PATH
export STEAM_COMPAT_CLIENT_INSTALL_PATH
# Run the uninstaller using Proton with the specified options
echo "Running uninstaller using Proton with the specified options"
"$STEAM_RUNTIME" "$proton_dir/proton" run "$uninstaller_path" $uninstaller_options
# Display Zenity window
zenity --info --text="$app_name has been uninstalled." --width=200 --height=150 &
sleep 3
killall zenity
}
# Function to handle EA App uninstallation
handle_uninstall_ea() {
mkdir -p ${logged_in_home}/Downloads/NonSteamLaunchersInstallation
# Download EA App file
if [ ! -f "$eaapp_file" ]; then
echo "Downloading EA App file"
wget $eaapp_url -O $eaapp_file
fi
handle_uninstall_common "$1" "$eaapp_file" "/uninstall /quiet" "EA App"
}
# Function to handle GOG Galaxy uninstallation
handle_uninstall_gog() {
gog_uninstaller="${logged_in_home}/.local/share/Steam/steamapps/compatdata/${1}/pfx/drive_c/Program Files (x86)/GOG Galaxy/unins000.exe"
handle_uninstall_common "$1" "$gog_uninstaller" "/SILENT" "GOG Galaxy"
}
# Uninstall EA App
if [[ $uninstall_options == *"Uninstall EA App"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Electronic Arts" ]]; then
handle_uninstall_ea "NonSteamLaunchers"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/pfx/drive_c/Program Files/Electronic Arts" ]]; then
handle_uninstall_ea "TheEAappLauncher"
fi
fi
# Uninstall GOG Galaxy
if [[ $uninstall_options == *"Uninstall GOG Galaxy"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/GOG Galaxy" ]]; then
handle_uninstall_gog "NonSteamLaunchers"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/GogGalaxyLauncher/pfx/drive_c/Program Files (x86)/GOG Galaxy" ]]; then
handle_uninstall_gog "GogGalaxyLauncher"
fi
fi
# Function to handle Legacy Games Launcher uninstallation
handle_uninstall_legacy() {
legacy_uninstaller="${logged_in_home}/.local/share/Steam/steamapps/compatdata/${1}/pfx/drive_c/Program Files/Legacy Games/Legacy Games Launcher/Uninstall Legacy Games Launcher.exe"
handle_uninstall_common "$1" "$legacy_uninstaller" "/allusers /S" "Legacy Games Launcher"
}
# Uninstall Legacy Games Launcher
if [[ $uninstall_options == *"Uninstall Legacy Games Launcher"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Legacy Games/Legacy Games Launcher" ]]; then
handle_uninstall_legacy "NonSteamLaunchers"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/LegacyGamesLauncher/pfx/drive_c/Program Files/Legacy Games/Legacy Games Launcher" ]]; then
handle_uninstall_legacy "LegacyGamesLauncher"
fi
fi
# Function to handle PlayStation Plus uninstallation
handle_uninstall_psplus() {
psplus_uninstaller="MsiExec.exe"
psplus_uninstaller_options="/X{3DE02040-3CB7-4D4A-950E-773F04FC4DE8} /quiet"
handle_uninstall_common "$1" "$psplus_uninstaller" "$psplus_uninstaller_options" "PlayStation Plus"
}
# Uninstall PlayStation Plus
if [[ $uninstall_options == *"Uninstall PlayStation Plus"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/PlayStationPlus" ]]; then
handle_uninstall_psplus "NonSteamLaunchers"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/PlaystationPlusLauncher/pfx/drive_c/Program Files (x86)/PlayStationPlus" ]]; then
handle_uninstall_psplus "PlaystationPlusLauncher"
fi
fi
uninstall_launcher() {
local uninstall_options=$1
local launcher=$2
local path1=$3
local path2=$4
local remove_path1=$5
local remove_path2=$6
shift 6
if [[ $uninstall_options == *"Uninstall $launcher"* ]]; then
if [[ -f "$path1" ]]; then
rm -rf "$remove_path1"
zenity --info --text="$launcher has been uninstalled." --width=200 --height=150 &
sleep 3
killall zenity
elif [[ -f "$path2" ]]; then
rm -rf "$remove_path2"
zenity --info --text="$launcher has been uninstalled." --width=200 --height=150 &
sleep 3
killall zenity
fi
for env_var_prefix in "$@"; do # Loop over the remaining arguments
sed -i "/^export ${env_var_prefix}.*/Id" "${logged_in_home}/.config/systemd/user/env_vars"
done
echo "Deleted environment variables for $launcher"
fi
}
# Function to process uninstall options
process_uninstall_options() {
local uninstall_options=$1
if [[ -n $uninstall_options ]]; then
# Call uninstall_launcher for each launcher
# Add more launchers as needed
if [[ $uninstall_options == *"Uninstall GOG Galaxy"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/GOG Galaxy" ]]; then
handle_uninstall_gog "NonSteamLaunchers"
uninstall_launcher "$uninstall_options" "GOG Galaxy" "$gog_galaxy_path1" "$gog_galaxy_path2" "" "" "gog"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/GogGalaxyLauncher/pfx/drive_c/Program Files (x86)/GOG Galaxy" ]]; then
handle_uninstall_gog "GogGalaxyLauncher"
uninstall_launcher "$uninstall_options" "GOG Galaxy" "$gog_galaxy_path1" "$gog_galaxy_path2" "" "" "gog"
fi
fi
if [[ $uninstall_options == *"Uninstall EA App"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Electronic Arts" ]]; then
handle_uninstall_ea "NonSteamLaunchers"
uninstall_launcher "$uninstall_options" "EA App" "$eaapp_path1" "$eaapp_path2" "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/users/steamuser/Downloads/EAappInstaller.exe" "${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/pfx/drive_c/users/steamuser/Downloads/EAappInstaller.exe" "eaapp" "ea_app"
sed -i '/repaireaapp/d' "${logged_in_home}/.config/systemd/user/env_vars"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/pfx/drive_c/Program Files/Electronic Arts" ]]; then
handle_uninstall_ea "TheEAappLauncher"
uninstall_launcher "$uninstall_options" "EA App" "$eaapp_path1" "$eaapp_path2" "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/users/steamuser/Downloads/EAappInstaller.exe" "${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/pfx/drive_c/users/steamuser/Downloads/EAappInstaller.exe" "eaapp" "ea_app"
sed -i '/repaireaapp/d' "${logged_in_home}/.config/systemd/user/env_vars"
fi
fi
if [[ $uninstall_options == *"Uninstall Legacy Games"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files/Legacy Games" ]]; then
handle_uninstall_legacy "NonSteamLaunchers"
uninstall_launcher "$uninstall_options" "Legacy Games" "$legacygames_path1" "$legacygames_path2" "" "" "legacy"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/LegacyGamesLauncher/pfx/drive_c/Program Files/Legacy Games" ]]; then
handle_uninstall_legacy "LegacyGamesLauncher"
uninstall_launcher "$uninstall_options" "Legacy Games" "$legacygames_path1" "$legacygames_path2" "" "" "legacy"
fi
fi
if [[ $uninstall_options == *"Uninstall Playstation Plus"* ]]; then
if [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/Program Files (x86)/PlayStationPlus" ]]; then
handle_uninstall_psplus "NonSteamLaunchers"
uninstall_launcher "$uninstall_options" "Playstation Plus" "$psplus_path1" "$psplus_path2" "" "" "psplus"
elif [[ -d "${logged_in_home}/.local/share/Steam/steamapps/compatdata/PlaystationPlusLauncher" ]]; then
handle_uninstall_psplus "PlaystationPlusLauncher"