← Back to team overview

torios-dev team mailing list archive

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

 

On 05/11/2015 12:01 AM, Nio Wiklund wrote:
> Hi Israel and Jack,
>
> Please tell me with details, what I should look for. I don't understand
> what is the problem.
>
> Best regards
> Nio
>
> Den 2015-05-11 02:49, Israel skrev:
>> ...
>
Hi,
I will post the code here, and attach it as well.
Maybe it will be easy to spot if there is an error......
I did fix one typo, so it may be fully working (I hope so)
But maybe I am missing something else...


#!/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

-- 
Regards

-Israel
ToriOS Team

#!/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

Follow ups

References