1
local duration=0
if [[ "$1" == "-m" && -n "$2" ]]; then
duration=$(($2 * 60))
fi
local count=0
while true; do
# shift arrow key down
# osascript -e 'tell application "System Events" to key code 126 using {shift down}'
# F-13
osascript -e 'tell application "System Events" to key code 105'
sleep 30
count=$((count + 30))
if [[ $duration -gt 0 ]]; then
if [[ $count -ge $duration ]]; then
break
fi
fi
# Print elapsed time every 60 seconds
if (( count % 60 == 0 )); then
echo -ne "\r$((count/60)) minutes elapsed\n"
fi
done
}