#!/bin/sh

DIALOG_RESULT=$(echo -e 'exit xfce\nsuspend\nhibernate\nreboot\npoweroff\nexit' | rofi -dmenu -i -p "SYSTEM" -hide-scrollbar -tokenize -lines 6 -eh 1 -width 25 -location 0 -xoffset 0 -yoffset 0 -padding 20 -disable-history)

echo "This result is : $DIALOG_RESULT"
sleep 1;

if [ "$DIALOG_RESULT" = "exit xfce" ];
then
    xfce4-session-logout --logout
elif [ "$DIALOG_RESULT" = "suspend" ];
then
    xfce4-session-logout --suspend
elif [ "$DIALOG_RESULT" = "hibernate" ];
then
    xfce4-session-logout --hibernate
elif [ "$DIALOG_RESULT" = "reboot" ];
then
    xfce4-session-logout --reboot
elif [ "$DIALOG_RESULT" = "poweroff" ];
then
    xfce4-session-logout --halt
elif [ "$DIALOG_RESULT" = "exit" ];
then
    exit 0
fi