Cover V05, I04
Article
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5

apr96.tar


Listing 4: Background monitor script (xmon)

#!/bin/sh
#
# Command: lock=<screenlock> xmon <secs> &
#
# Monitor keyboard and mouse activity and execute <screenlock> when no
# activity has occurred in the last <secs> seconds
#
# Calls:   chkact to determine if <secs> seconds of keyboard & mouse
# inactivity has occurred
#          chkact returns:
#
#              1 - if termination signal was received
#              0 - if <secs> seconds of inactivity has occurred
#
# Programmer: Doug Morris 4/20/95
#

# set wait period to 300 secs if <secs> not specified

wait=$1
test -z "$wait" && wait=300

# loop until termination signal is received

exit=N
while [ $exit = N ]
do

# call chkact to do monitor keyboard and mouse activity

chkact $wait >/dev/null

# lock screen if chkact has returned 0

if [ $? -eq 0 ]
then $lock
else exit=Y
fi

done

# End of File