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