diff --git a/stow_me/scripts/app_close_and_restart.sh b/stow_me/scripts/app_close_and_restart.sh index 2ff3e3a..5cebdf2 100755 --- a/stow_me/scripts/app_close_and_restart.sh +++ b/stow_me/scripts/app_close_and_restart.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Funktion til Flatpak apps +# Function for Flatpak apps close_flatpak() { local app="$1" flatpak kill "$app" @@ -14,10 +14,10 @@ close_flatpak() { done echo "$app force closing (KILL)..." pkill -KILL -f "$app" - pkill -KILL -f bwrap 2>/dev/null # dræb sandbox container + pkill -KILL -f bwrap 2>/dev/null # kill sandbox container } -# Funktion til native apps +# Function for native apps close_app() { local app="$1" pkill -TERM -f "$app" @@ -34,13 +34,21 @@ close_app() { pkill -KILL -f "$app" } -# Luk apps +# Prompt +read -r -p "Close all programs and reboot? [Y/n]: " response +response="${response:-Y}" +if [[ ! "$response" =~ ^[Yy]$ ]]; then + echo "Cancelled." + exit 0 +fi + +# Close apps close_flatpak "com.discordapp.Discord" close_flatpak "io.github.lullabyX.sone" close_flatpak "rocks.shy.VacuumTube" close_app "firefox" -# Steam +# Close Steam if pgrep -f steam > /dev/null; then steam -shutdown for i in $(seq 1 5); do @@ -56,14 +64,12 @@ else echo "Steam not running, skipping..." fi -# 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 +# Countdown – Ctrl+C to cancel +echo "All programs closed. Rebooting in:" +for i in 3 2 1; do + echo " $i..." + sleep 1 +done +sudo shutdown -r now diff --git a/stow_me/scripts/app_close_and_shutdown.sh b/stow_me/scripts/app_close_and_shutdown.sh index 8de9c58..bd5e572 100755 --- a/stow_me/scripts/app_close_and_shutdown.sh +++ b/stow_me/scripts/app_close_and_shutdown.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Funktion til Flatpak apps +# Function for Flatpak apps close_flatpak() { local app="$1" flatpak kill "$app" @@ -14,10 +14,10 @@ close_flatpak() { done echo "$app force closing (KILL)..." pkill -KILL -f "$app" - pkill -KILL -f bwrap 2>/dev/null # dræb sandbox container + pkill -KILL -f bwrap 2>/dev/null # kill sandbox container } -# Funktion til native apps +# Function for native apps close_app() { local app="$1" pkill -TERM -f "$app" @@ -34,13 +34,21 @@ close_app() { pkill -KILL -f "$app" } -# Luk apps +# Prompt +read -r -p "Close all programs and shut down? [Y/n]: " response +response="${response:-Y}" +if [[ ! "$response" =~ ^[Yy]$ ]]; then + echo "Cancelled." + exit 0 +fi + +# Close apps close_flatpak "com.discordapp.Discord" close_flatpak "io.github.lullabyX.sone" close_flatpak "rocks.shy.VacuumTube" close_app "firefox" -# Steam +# Close Steam if pgrep -f steam > /dev/null; then steam -shutdown for i in $(seq 1 5); do @@ -56,13 +64,11 @@ else echo "Steam not running, skipping..." fi -# Prompt -read -r -p "All programs closed. Shut down? [Y/n]: " response -response="${response:-Y}" # Y er default ved enter - -if [[ "$response" =~ ^[Yy]$ ]]; then - sudo shutdown -h now -else - echo "Shutdown cancelled." -fi +# Countdown – Ctrl+C to cancel +echo "All programs closed. Shutting down in:" +for i in 3 2 1; do + echo " $i..." + sleep 1 +done +sudo shutdown -h now