diff --git a/scripts/app_close_and_restart.sh b/scripts/app_close_and_restart.sh index d428b3c..2ff3e3a 100755 --- a/scripts/app_close_and_restart.sh +++ b/scripts/app_close_and_restart.sh @@ -16,6 +16,7 @@ close_flatpak() { pkill -KILL -f "$app" pkill -KILL -f bwrap 2>/dev/null # dræb sandbox container } + # Funktion til native apps close_app() { local app="$1" @@ -32,11 +33,13 @@ close_app() { echo "$app force closing (KILL)..." pkill -KILL -f "$app" } + # Luk apps close_flatpak "com.discordapp.Discord" close_flatpak "io.github.lullabyX.sone" close_flatpak "rocks.shy.VacuumTube" close_app "firefox" + # Steam if pgrep -f steam > /dev/null; then steam -shutdown @@ -52,13 +55,15 @@ if pgrep -f steam > /dev/null; then else echo "Steam not running, skipping..." fi -# Popup -zenity --question \ - --title="Restart" \ - --text="All programs have been closed.\nDo you want to restart the PC?" \ - --ok-label="Restart" \ - --cancel-label="Cancel" \ - 2>/dev/null -if [ $? -eq 0 ]; then + +# Prompt +read -r -p "All programs closed. Reboot? [Y/n]: " response +response="${response:-Y}" # Y er default ved enter + +if [[ "$response" =~ ^[Yy]$ ]]; then sudo shutdown -r now +else + echo "Reboot cancelled." fi + + diff --git a/scripts/app_close_and_shutdown.sh b/scripts/app_close_and_shutdown.sh index 51a835f..8de9c58 100755 --- a/scripts/app_close_and_shutdown.sh +++ b/scripts/app_close_and_shutdown.sh @@ -1,5 +1,4 @@ #!/bin/bash - # Funktion til Flatpak apps close_flatpak() { local app="$1" @@ -57,14 +56,13 @@ else echo "Steam not running, skipping..." fi -# Popup -zenity --question \ - --title="Shutdown" \ - --text="All programs have been closed.\nDo you want to shut down the PC?" \ - --ok-label="Shut down" \ - --cancel-label="Cancel" \ - 2>/dev/null +# Prompt +read -r -p "All programs closed. Shut down? [Y/n]: " response +response="${response:-Y}" # Y er default ved enter -if [ $? -eq 0 ]; then +if [[ "$response" =~ ^[Yy]$ ]]; then sudo shutdown -h now +else + echo "Shutdown cancelled." fi +