#! /bin/bash

/sbin/shutdown -h +1&
yad --width 400 --center  --window-icon="/usr/share/icons/gnome/16x16/status/battery-caution.png" --image="/usr/share/icons/Tango/32x32/emotes/face-surprise.png" --title "LOW BATTERY" \
     --text="\n   This computer will be shut down in 60 seconds, \n    unless you hit cancel. \
	 \n\nBe aware that once the battery dies it will crash, \nand could cause filesystem damage.\nSo do not delay...\n" --timeout=55 --button=CANCEL:1 --button=OK:2

if [[ $? -eq 1 ]] ; then
	# user clicked Cancel
	/sbin/shutdown -c
fi