Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # fiteme v. 0.21 by Marc Carson
- # 5 April 2020
- #
- # This script allows a user to select a chained timer sequence, for example
- # 15 minute Circle tasks, 5 minute planning, 25 minute work.
- # Timer concept based on TaskBATL "FiTe Timer" module by Marc Carson
- # More info:
- # https://www.friendlyskies.net/intj/the-balance-first-approachable-to-do-list
- #
- # Dependencies: zenity, espeak
- # Configuration: You will need to change the Scriptlocation strings below
- # so that the script knows where to find your script.
- #
- ## To-Do List
- ## TODO: Move the local file references into a configuration var up top.
- ## TODO: Make the script a tad more efficient. :]=
- ## TODO: Make the script location automatic
- #
- # Marc Carson
- # https://www.friendlyskies.net
- # https://www.marccarsoncoaching.com
- function zenityNoWarn() {
- # Replace default zenity call with this handy Gtk error suppressor.
- # Without this you'll get Gtk Warnings in the terminal output.
- # Added 2020-04-05
- zenity "$@" 2> >(grep -v 'GtkDialog' >&2)
- }
- fitenormal () {
- # 15, 5, 25 minute timer function
- if zenityNoWarn --question --text="Start 15 minute circle timer?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Have fun for 15 minutes!"
- time=$(date +%T)
- echo "**Started 15m block with circle," $time
- sleep 13m
- espeak "Two minutes of circle timer left."
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="2 minutes left in circle timer."
- sleep 2m
- espeak "Circle timer complete."
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Start 5 minute planning?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Planning or howling for 5 minutes begins now"
- time=$(date +%T)
- echo "Started 5m planning block," $time
- sleep 3m
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="2 minutes left in planning timer."
- espeak "Two minutes of planning left."
- sleep 2m
- espeak "Planning timer complete."
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Start 25 minute work tasks?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Work for 25 minutes begins now"
- time=$(date +%T)
- echo "Started 25m work block," $time
- sleep 23m
- espeak "Two minutes of work left."
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="2 minutes left in work timer."
- sleep 2m
- espeak "Work timer complete."
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Cycle complete. Start new timer?"; then
- ScriptLocation=$(/home/marc/Dropbox/bin/fiteme)
- exec "$ScriptLocation"
- else
- exit 1
- fi
- }
- fiteheavy () {
- # 45-10-25 minute timer function
- if zenityNoWarn --question --text="Start 45 minute circle timer..."; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Circle activities for 45 minutes begins now"
- time=$(date +%T)
- echo "**Started 45m block with circle," $time
- sleep 40m
- espeak "Five minutes of circle left."
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="2 minutes left in circle timer."
- sleep 5m
- espeak "All done with circle. The circle timer has finished."
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Start 10 minute planning?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Planning or howling for 10 minutes begins now"
- time=$(date +%T)
- echo "Started 10m planning block," $time
- sleep 8m
- espeak "Two minutes of planning left."
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="2 minutes left in planning timer."
- sleep 2m
- espeak "Planning cycle complete."
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Start 25 minute work tasks?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Work for 25 minutes begins now"
- time=$(date +%T)
- echo "Started 25m work block," $time
- sleep 23m
- espeak "Two minutes of work left."
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="2 minutes left in work timer."
- sleep 2m
- espeak "The work cycle is complete."
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Cycle complete. Start new timer?"; then
- ScriptLocation=$(/home/marc/Dropbox/bin/fiteme)
- exec "$ScriptLocation"
- else
- exit 1
- fi
- }
- fitetester () {
- # Test function only; run through a timer cycle quickly.
- if zenityNoWarn --question --text="Start test timer?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Have fun for seconds!"
- time=$(date +%T)
- echo "***Started 3s test block," $time
- sleep 3s
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Start planning?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Planning or howling for seconds begins now"
- time=$(date +%T)
- echo "***Started 3s test block," $time
- sleep 3s
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Start work tasks?"; then
- zenityNoWarn --notification\
- --window-icon="info" \
- --text="Work for seconds begins now"
- time=$(date +%T)
- echo "***Started 3s test block," $time
- sleep 3s
- else
- exit 1
- fi
- if zenityNoWarn --question --text="Cycle complete. Start new timer?"; then
- ScriptLocation=$(/home/marc/Dropbox/bin/fiteme)
- exec "$ScriptLocation"
- else
- exit 1
- fi
- }
- # Start: Present the user with a list of timers to choose.
- identifier=$(zenityNoWarn --list \
- --title="Choose your timer" \
- --column="Name" --column="Configuration" \
- Normal 15-5-25 \
- FiHeavy 45-10-25 \
- FiteTester 3s-Each)
- norm="Normal"
- fiheavy="FiHeavy"
- tester="FiteTester"
- if [ "$identifier" = "$norm" ]; then
- # They chose the Normal timer...
- fitenormal
- fi
- if [ "$identifier" = "$fiheavy" ]; then
- # They chose the FiHeavy timer...
- fiteheavy
- fi
- if [ "$identifier" = "$tester" ]; then
- # They chose the FiHeavy timer...
- fitetester
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement