#!/bin/sh
TIMEOUT=300000 # 10min = 10 * 60 * 1000

export DISPLAY=":0"
if [ $(ps ax|grep -v grep|grep -c mate-session) -gt 0 ]; then

 if [ $(xprintidle) -gt $TIMEOUT ]; then
    notify-send -t 60000 -i system-shutdown-panel-restart -u critical "WARNING" "Logged out in 60s. To prevent this, move the mouse!" 
    sleep 60;
  if [ $(xprintidle) -gt $TIMEOUT ]; then
    killall mate-session;
  fi
 fi
#echo $(export DISPLAY=":0" && xprintidle)
fi
