I would like to improve on my fluxbox shutdown gui.
I would like to have the option for each of my chooses to have a yes to continue or cancel if they forgot something and start all over.
How would I be able to do this?
#!/bin/sh
#MODES are poweroff reboot exit
## FUNCTIONS
set -a #export all functions
fluxexit () {
echo -n "$1" > /tmp/wmexitmode.txt
KCNT=0
PSPEFD="`ps -C pup_event_frontend_d | grep 'pup_event_front' | grep -v 'defunct'`"
while [ "$PSPEFD" != "" ];do
sleep 0.5
KCNT=`expr $KCNT + 1`
[ $KCNT -gt 60 ] && break #30 secs.
PSPEFD="`ps -C pup_event_frontend_d | grep 'pup_event_front' | grep -v 'defunct'`"
done
sleep 0.2
sync
#CURRENTWM="`cat /etc/windowmanager`"
#if [ "$CURRENTWM" = "startxfce4" ];then
#CURRENTWM="xfce4-session"
#fi
#kill -9 `pidof $CURRENTWM`
kill -9 `pidof fluxbox`
}
export MAIN_DIALOG='
<window title="Shutdown" icon-name="shutdown24" resizable="false" decorated="true" height-request="0" width-request="250">
<vbox>
<hseparator></hseparator>
<text wrap="false" xalign="0.5" selectable="false">
<label>Options</label>
</text>
<hseparator></hseparator>
<hbox>
<frame>
<vbox>
<button height-request="0" width-request="125">
<label>Power-Off</label>
<input file stock="gtk-disconnect"></input>
<action>fluxexit poweroff &</action>
<action type="exit">exiting completed</action>
</button>
<button height-request="0" width-request="125">
<label>Reboot</label>
<input file stock="gtk-connect"></input>
<action>fluxexit reboot &</action>
<action type="exit">exiting completed</action>
</button>
</vbox>
</frame>
<frame>
<vbox>
<button height-request="0" width-request="125">
<label>Restart X</label>
<input file stock="gtk-refresh"></input>
<action>fluxexit restartwm &</action>
<action type="exit">exiting completed</action>
</button>
<button height-request="0" width-request="125">
<label>Log-Out</label>
<input file stock="gtk-ok"></input>
<action>fluxexit exit &</action>
<action type="exit">exiting completed</action>
</button>
</vbox>
</frame>
</hbox>
<vbox>
<hseparator></hseparator>
<button cancel></button>
<hseparator></hseparator>
</vbox>
</vbox>
</window>
'
gtkdialog --center --program=MAIN_DIALOG