Re: desktop power button

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux