From a3589e9ec12be6cd316feb4fd50436a6b47ab639 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sat, 4 May 2024 01:42:45 -0700 Subject: [PATCH] reworked uninstall --- NonSteamLaunchers.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index f968657..6c68ec8 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -546,9 +546,10 @@ if [[ $options == "Start Fresh" ]] || [[ $selected_launchers == "Start Fresh" ]] fi fi +# Check if any arguments were passed if [[ ${#args[@]} -eq 0 ]]; then -# Check if the cancel button was clicked - # The OK button was not clicked + # No arguments were passed, use Zenity + action="Uninstall" # Define the launcher options options=$(zenity --list --checklist \ --title="Uninstall Launchers" \ @@ -571,18 +572,14 @@ if [[ ${#args[@]} -eq 0 ]]; then FALSE "Playstation Plus"\ FALSE "VK Play") else - # Arguments were passed, use them as options - options="${args[@]}" # The args are the selected options - fi - - # Check if the options contain "Uninstall" - if [[ $options == *"Uninstall"* ]]; then - # Remove "Uninstall" from the options - options=${options//Uninstall/} + # Arguments were passed, use them as options + action="${args[0]}" + unset 'args[0]' # Remove the action from the args array + options="${args[@]}" # The remaining args are the selected options fi - if [[ $options != "" ]]; then + if [[ $action == "Uninstall" ]]; then # The Uninstall button was clicked # Add code here to handle the uninstallation of the selected launcher(s) if [[ $options == *"Epic Games"* ]]; then