From 7e1da776b9fd1069492d88ae8540c8bbc3458f23 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:40:04 -0700 Subject: [PATCH] Add files via upload --- NonSteamLaunchers.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 102829c..d390d50 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -951,12 +951,7 @@ else fi -# Get the command line arguments -args=("$@") - -# Check if the Stop NSLGameScanner option was passed as a command line argument or clicked in the GUI -if [[ " ${args[@]} " =~ " Stop NSLGameScanner " ]] || [[ $options == "Stop NSLGameScanner" ]]; then - +function stop_service { # Stop the service systemctl --user stop nslgamescanner.service @@ -971,6 +966,14 @@ if [[ " ${args[@]} " =~ " Stop NSLGameScanner " ]] || [[ $options == "Stop NSLGa # Reload the systemd user instance systemctl --user daemon-reload +} + +# Get the command line arguments +args=("$@") + +# Check if the Stop NSLGameScanner option was passed as a command line argument or clicked in the GUI +if [[ " ${args[@]} " =~ " Stop NSLGameScanner " ]] || [[ $options == "Stop NSLGameScanner" ]]; then + stop_service # If command line arguments were provided, exit the script if [ ${#args[@]} -ne 0 ]; then @@ -985,11 +988,13 @@ if [[ " ${args[@]} " =~ " Stop NSLGameScanner " ]] || [[ $options == "Stop NSLGa python3 $python_script_path else # User does not want to run NSLGameScanner again + stop_service exit 1 fi 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 (