Skip to content

Instantly share code, notes, and snippets.

@yaasita
Created May 24, 2014 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaasita/b651882a405413bfddcd to your computer and use it in GitHub Desktop.
Save yaasita/b651882a405413bfddcd to your computer and use it in GitHub Desktop.
#!/bin/bash
DISPLAY=:0
function previous {
sleep $1
eval $(xdotool getmouselocation --shell)
echo "$X,$Y"
}
while :;do
p05=`previous 5m`
p10=`previous 10m`
p15=`previous 15m`
if [ "$p05" = "$p10" ] && [ "$p05" = "$p15" ] ; then
sudo pm-suspend
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment