Answer the question
In order to leave comments, you need to log in
Is it possible to limit the read command?
#!/bin/sh
set -x
IDLE_TIME=$((5000))
while [ 0 ]
do
sleep_time=$IDLE_TIME
triggered=false
if [ read R</dev/ttyUSB0 ]; then
if [ "$R" -eq "Sleep" ]; then
echo '&'> /dev/ttyUSB0
fi
fi
idle=$(xprintidle)
if [ $idle -ge $IDLE_TIME ]; then
if ! $triggered; then
zenity --question --title="Бездействие пользователя" \
--text="Вы возле компьютера?" \
--timeout=10
if [ $? -eq "0" ]
then
triggered=false
sleep_time=$((IDLE_TIME-idle+100))
else echo '&'> /dev/ttyUSB0
triggered=true
sleep_time=$IDLE_TIME
fi
fi
fi
sleep 1
done
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question