Changed shutdown/reboot dialog from zenity to

directly in terminal.
This commit is contained in:
2026-05-22 16:15:45 +02:00
parent 83e9159d0e
commit 2e57d9defb
2 changed files with 20 additions and 17 deletions
+13 -8
View File
@@ -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
+7 -9
View File
@@ -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