On 11/19/23 14:32, ToddAndMargo via users wrote:
On 11/17/23 21:28, ToddAndMargo via users wrote:
Create a .desktop file that runs "poweroff" or "reboot" depending on what you're wanting to do.

Thank you!

That will work perfectly.


I can easily work this into a bash script.

$ Xdialog --icon "/usr/share/icons/hicolor/48x48/actions/xfsm-shutdown.png" --wrap --title "Power Off" --yesno 'Power off?' 8 40; echo $?


Okay, I might have gotten a little silly here, but this will
work for low skill users.

<PowerOff.sh>
#!/usr/bin/bash

# pop up dialog to power off the computer

Icon="/usr/share/icons/hicolor/48x48/actions/xfsm-shutdown.png"
Title="Power Off"
Msg="Power off?"
InfoBox="Powering off / shutting down the computer\n\n NNNNOOOOOOooooooo....."
Help="\
  YES  powers off the computer (Shutdown)\n\
   NO  cancels the operation\n\
HELP  give you this silly message"

# Xdialog: --yesno    <text> <height> <width>
# Xdialog: --yesno: : 0 = yes; 1 = no; 255 = "X" in the upper right corner Xdialog --icon "$Icon" --left --help "$Help" --title "$Title" --yesno "$Msg" 12 60
ReturnNum=$?
# echo $ReturnNum

if [ $ReturnNum == 0 ]; then
   echo "Power Off initiated"

# Xdialog: --infobox <text> <height> <width> [<timeout in milliseconds>]
   Xdialog --title "$Title"  --infobox "$InfoBox" 10 75 4000
   poweroff

else
   echo "Power off operation cancelled"
fi
</PowerOff.sh
--
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to