#!/usr/bin/sh
if type -p rofi 2> /dev/null; then
	alias selectcommand="rofi -dmenu -i -theme themes/power.rasi -me-select-entry '' -me-accept-entry MousePrimary"
	shutdown=""
	reboot=""
	lock=""
	suspend=""
	logout="﫼"
else
	alias selectcommand="dmenu -i -p 'Option'"
	shutdown="Shutdown"
	reboot="Reboot"
	lock="Lock"
	suspend="Suspend"
	logout="Logout"
fi


selection=$( \
	echo -e "$shutdown\n$reboot\n$lock\n$logout\n$suspend" | selectcommand
	);
echo $selection;

sleep .2

case $selection in
	$lock)
		#i3exit lock
		;;
	$logout)
		pkill dwm
		;;
	$suspend)
		systemctl suspend
		#i3exit lock
		;;
	$reboot)
		systemctl reboot
		;;
	$shutdown)
		systemctl poweroff
		;;
esac