Just something to replace the scraps of paper on my desk.
pmset -g assertions|grep -q '^ *UserIsActive *1$' && echo "User active" || echo "user inactive"
Woo!