10-10-2020, 12:03 AM
I'd like to redefine the power switch so it brings up a whiptail confirmation dialog or something like that before it actually shuts off. Suspend could easily be added to that as another choice.
Is that possible? I keep hitting it by accident. I'm using the original Debian Stretch still. Something like:
Is that possible? I keep hitting it by accident. I'm using the original Debian Stretch still. Something like:
Code:
#!/bin/bash
TERM=ansi whiptail --title "Power button" --menu "Power Button" 8 20 5 \
"Turn off" "" \
"Suspend" "" \
"Cancel" ""
choice=$?
if [ $choice = 0 ]; then
echo "Shutting down"
shutdown now
else
if [ $choice = 1 ]; then
echo "Suspending"
# write this
else
echo "Cancelling"
fi
fi