← Back to team overview

torios-dev team mailing list archive

Re: [Torios] Reboot Dialog Was:(Re: Plymouth Theme)

 

PNG image

#!/bin/bash
if [ ! -z "$(which dbus-send)" ]
then
  SHUTDOWN="dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart"
else
  SHUTDOWN="xterm -e 'sudo reboot'"
fi

if [ ! -z "$(which zenity)" ]
then
zenity --question --title="Restart" --text="Restart?"
  case $? in 
     0) echo "Reboot"
     ${SHUTDOWN}
       ;;
     1) exit 1;;
    -1) exit 2;;
    esac
else
  if [ ! -z "$(which gxmessage)" ]
  then
    MESSAGE="$(which gxmessage) -borderless"
  else
    if [ ! -z "$(which xmessage)" ]
    then
      MESSAGE=xmessage
    else
      xterm -e "echo Reboot; ${SHUTDOWN}"
     fi ## XMESSAGE
  fi ## GXMESSAGE

  $MESSAGE -nearmouse -buttons "Yes:3,No:4" -name "Restart" "Restart?"
  case $? in

  3) echo "Reboot"
     ${SHUTDOWN}
  ;; 

  *)  echo "Not restarting"
  ;; 

 esac

fi ## zenity

References