Created
April 30, 2020 03:06
-
-
Save utdemir/c5296b21adfec80e6ad84b63e0e719a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
STRETCH_DURATION_SECONDS=20 | |
STRETCH_INTERVAL_MINUTES=10 | |
REST_RECURRENCE=6 | |
REST_DURATION_MINUTES=10 | |
if ! command -v yad >/dev/null 2>&1; then | |
echo "This script requires a 'yad' executable on PATH. Exiting." 2>&1 | |
exit 1 | |
fi | |
rest_remaining=$REST_RECURRENCE | |
while true; do | |
wait_secs="$(( STRETCH_INTERVAL_MINUTES * 60 - STRETCH_DURATION_SECONDS ))" | |
echo "Working for $wait_secs seconds." | |
pv /dev/zero -L 1 -s "$wait_secs" -p | head -c "$wait_secs" | |
rest_remaining=$(( rest_remaining - 1 )) | |
if [[ $rest_remaining -gt 0 ]]; then | |
echo "Stretching for $STRETCH_DURATION_SECONDS seconds." | |
yad \ | |
--info --title "ergo" \ | |
--timeout-indicator bottom --center --on-top --sticky --no-buttons --no-escape \ | |
--text='<span font="32">Flop your arms and strech.</span>' --text-align "center" \ | |
--timeout="$STRETCH_DURATION_SECONDS" | |
else | |
echo "Resting for $REST_DURATION_MINUTES minutes." | |
yad \ | |
--info --title "ergo" \ | |
--timeout-indicator bottom --center --on-top --sticky --no-buttons --no-escape \ | |
--text='<span font="32">Rest up!</span>' --text-align "center" \ | |
--timeout="$(( REST_DURATION_MINUTES * 60 ))" | |
rest_remaining=$REST_RECURRENCE | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment