Advertisement
systems_architect

Productivity Timer Script v. 0.2

Apr 5th, 2020
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.08 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # fiteme v. 0.2 by Marc Carson
  4. # 5 April 2020
  5. #
  6. # This script allows a user to select a chained timer sequence, for example
  7. # 15 minute Circle tasks, 5 minute planning, 25 minute work.
  8. # Timer concept based on TaskBATL "FiTe Timer" module by Marc Carson
  9. # More info:
  10. # https://www.friendlyskies.net/intj/the-balance-first-approachable-to-do-list
  11. #
  12. # Dependencies: zenity, espeak
  13. #
  14. ## To-Do List
  15. ## TODO: Make the script a tad more efficient. :]=
  16. ##
  17. # Marc Carson
  18. # https://www.friendlyskies.net
  19. # https://www.marccarsoncoaching.com
  20.  
  21. function zenityNoWarn() {
  22.     # Replace default zenity call with this handy Gtk error suppressor.
  23.     # Without this you'll get Gtk Warnings in the terminal output.
  24.     # Added 2020-04-05
  25.     zenity "$@" 2> >(grep -v 'GtkDialog' >&2)
  26. }
  27.  
  28. fitenormal () {
  29.     # 15, 5, 25 minute timer function
  30.     if zenityNoWarn --question --text="Start 15 minute circle timer?"; then
  31.         zenityNoWarn --notification\
  32.             --window-icon="info" \
  33.             --text="Have fun for 15 minutes!"
  34.         sleep 13m
  35.         espeak "Two minutes of circle timer left."
  36.         sleep 2m
  37.         espeak "Circle timer complete."
  38.     else
  39.         exit 1
  40.     fi
  41.     if zenityNoWarn --question --text="Start 5 minute planning?"; then
  42.         zenityNoWarn --notification\
  43.             --window-icon="info" \
  44.             --text="Planning or howling for 5 minutes begins now"
  45.         sleep 3m
  46.         espeak "Two minutes of planning left."
  47.         sleep 2m
  48.         espeak "Planning timer complete."
  49.     else
  50.         exit 1
  51.     fi
  52.  
  53.     if zenityNoWarn --question --text="Start 25 minute work tasks?"; then
  54.         zenityNoWarn --notification\
  55.             --window-icon="info" \
  56.             --text="Work for 25 minutes begins now"
  57.         sleep 23m
  58.         espeak "Two minutes of work left."
  59.         sleep 2m
  60.         espeak "Work timer complete."
  61.     else
  62.         exit 1
  63.     fi
  64.     if zenityNoWarn --question --text="Cycle complete. Start new timer?"; then
  65.         ScriptLocation=$(/home/marc/Dropbox/bin/fiteme)
  66.         exec "$ScriptLocation"
  67.     else
  68.         exit 1
  69.     fi
  70. }
  71.  
  72. fiteheavy () {
  73.     # 45-10-25 minute timer function
  74.     if zenityNoWarn --question --text="Start 45 minute circle timer..."; then
  75.         zenityNoWarn --notification\
  76.             --window-icon="info" \
  77.             --text="Circle activities for 45 minutes begins now"
  78.         sleep 40m
  79.         espeak "Five minutes of circle left."
  80.         sleep 5m
  81.         espeak "All done with circle. The circle timer has finished."
  82.     else
  83.         exit 1
  84.     fi
  85.     if zenityNoWarn --question --text="Start 10 minute planning?"; then
  86.         zenityNoWarn --notification\
  87.             --window-icon="info" \
  88.             --text="Planning or howling for 10 minutes begins now"
  89.         sleep 8m
  90.         espeak "Two minutes of planning left."
  91.         sleep 2m
  92.         espeak "Planning cycle complete."
  93.     else
  94.         exit 1
  95.     fi
  96.  
  97.     if zenityNoWarn --question --text="Start 25 minute work tasks?"; then
  98.         zenityNoWarn --notification\
  99.             --window-icon="info" \
  100.             --text="Work for 25 minutes begins now"
  101.         sleep 23m
  102.         espeak "Two minutes of work left."
  103.         sleep 2m
  104.         espeak "The work cycle is complete."
  105.     else
  106.         exit 1
  107.     fi
  108.     if zenityNoWarn --question --text="Cycle complete. Start new timer?"; then
  109.         ScriptLocation=$(/home/marc/Dropbox/bin/fiteme)
  110.         exec "$ScriptLocation"
  111.     else
  112.         exit 1
  113.     fi
  114. }
  115.  
  116. fitetester () {
  117.     # Test function only; run through a timer cycle quickly.
  118.     if zenityNoWarn --question --text="Start test timer?"; then
  119.         zenityNoWarn --notification\
  120.             --window-icon="info" \
  121.             --text="Have fun for seconds!"
  122.         sleep 3s
  123.     else
  124.         exit 1
  125.     fi
  126.     if zenityNoWarn --question --text="Start planning?"; then
  127.         zenityNoWarn --notification\
  128.             --window-icon="info" \
  129.             --text="Planning or howling for seconds begins now"
  130.         sleep 3s
  131.     else
  132.         exit 1
  133.     fi
  134.  
  135.     if zenityNoWarn --question --text="Start work tasks?"; then
  136.         zenityNoWarn --notification\
  137.             --window-icon="info" \
  138.             --text="Work for seconds begins now"
  139.         sleep 3s
  140.     else
  141.         exit 1
  142.     fi
  143.     if zenityNoWarn --question --text="Cycle complete. Start new timer?"; then
  144.         ScriptLocation=$(/home/marc/Dropbox/bin/fiteme)
  145.         exec "$ScriptLocation"
  146.     else
  147.         exit 1
  148.     fi
  149. }
  150.  
  151. # Start: Present the user with a list of timers to choose.
  152.  
  153. identifier=$(zenityNoWarn --list \
  154.  --title="Choose your timer" \
  155.  --column="Name" --column="Configuration" \
  156.   Normal 15-5-25 \
  157.   FiHeavy 45-10-25 \
  158.   FiteTester 3s-Each)
  159.  
  160. norm="Normal"
  161.  
  162. fiheavy="FiHeavy"
  163.  
  164. tester="FiteTester"
  165.  
  166. if [ "$identifier" = "$norm" ]; then
  167.     # They chose the Normal timer...
  168.     fitenormal
  169. fi
  170.  
  171. if [ "$identifier" = "$fiheavy" ]; then
  172.     # They chose the FiHeavy timer...
  173.     fiteheavy
  174. fi
  175.  
  176. if [ "$identifier" = "$tester" ]; then
  177.     # They chose the FiHeavy timer...
  178.     fitetester
  179. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement