systems_architect

fiteme Productivity Timer Script (Bash)

Apr 5th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.91 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Allows a user to select a chained timer sequence, for example
  4. # 15 minute Circle tasks, 5 minute planning, 25 minute work.
  5. # Timer concept based on TaskBATL "FiTe Timer" module by Marc Carson
  6. # www.marccarsoncoaching.com
  7. # www.friendlyskies.net/intj/
  8. #
  9. # Dependencies: Zenity
  10. #
  11. ## To-Do List
  12. ## TODO: Make the script a tad more efficient. :]=
  13. ## TODO: Figure out how to make this thing let you start a new timer.
  14.  
  15. # ScriptLocation=$(fiteme)  ...recursion problems.
  16.  
  17. function zenityNoWarn() {
  18.     # Replace default zenity call with this handy Gtk error suppressor.
  19.     # Without this you'll get Gtk Warnings in the terminal output.
  20.     # Added 2020-04-05
  21.     zenity "$@" 2> >(grep -v 'GtkDialog' >&2)
  22. }
  23.  
  24. fitenormal () {
  25.     # 15, 5, 25 minute timer function
  26.     if zenityNoWarn --question --text="Start 15 minute circle timer?"; then
  27.         zenityNoWarn --notification\
  28.             --window-icon="info" \
  29.             --text="Have fun for 15 minutes!"
  30.         sleep 13m
  31.         espeak "Two minutes of circle circle circle left."
  32.         sleep 2m
  33.         espeak "All done with fun. The fun is done."
  34.     else
  35.         exit 1
  36.     fi
  37.     if zenityNoWarn --question --text="Start 5 minute planning?"; then
  38.         zenityNoWarn --notification\
  39.             --window-icon="info" \
  40.             --text="Planning or howling for 5 minutes begins now"
  41.         sleep 3m
  42.         espeak "Two minutes of planning left."
  43.         sleep 2m
  44.         espeak "All done with plan. The plan is the man."
  45.     else
  46.         exit 1
  47.     fi
  48.  
  49.     if zenityNoWarn --question --text="Start 25 minute work tasks?"; then
  50.         zenityNoWarn --notification\
  51.             --window-icon="info" \
  52.             --text="Work for 25 minutes begins now"
  53.         sleep 23m
  54.         espeak "Two minutes of work left."
  55.         sleep 2m
  56.         espeak "All done with work. To work is not to lurk. Have some fun."
  57.     else
  58.         exit 1
  59.     fi
  60.     if zenityNoWarn --question --text="Cycle complete. OK to start again?"; then
  61.         echo "Run me again then. LOL"
  62.     else
  63.         exit 1
  64.     fi
  65. }
  66.  
  67. fiteheavy () {
  68.     # 45-10-25 minute timer function
  69.     if zenityNoWarn --question --text="Start 45 minute circle timer..."; then
  70.         zenityNoWarn --notification\
  71.             --window-icon="info" \
  72.             --text="Circle activities for 45 minutes begins now"
  73.         sleep 40m
  74.         espeak "Five minutes of circle circle circle left."
  75.         sleep 5m
  76.         espeak "All done with circle. The circling has finished."
  77.     else
  78.         exit 1
  79.     fi
  80.     if zenityNoWarn --question --text="Start 10 minute planning?"; then
  81.         zenityNoWarn --notification\
  82.             --window-icon="info" \
  83.             --text="Planning or howling for 10 minutes begins now"
  84.         sleep 8m
  85.         espeak "Two minutes of planning left."
  86.         sleep 2m
  87.         espeak "All done with planning. The planning is a wrap."
  88.     else
  89.         exit 1
  90.     fi
  91.  
  92.     if zenityNoWarn --question --text="Start 25 minute work tasks?"; then
  93.         zenityNoWarn --notification\
  94.             --window-icon="info" \
  95.             --text="Work for 25 minutes begins now"
  96.         sleep 23m
  97.         espeak "Two minutes of work left."
  98.         sleep 2m
  99.         espeak "All done with work. The work is a wrap. Have some fun."
  100.     else
  101.         exit 1
  102.     fi
  103.     if zenityNoWarn --question --text="Cycle complete. OK to start again?"; then
  104.         echo "Run me again then. LOL"
  105.     else
  106.         exit 1
  107.     fi
  108. }
  109.  
  110. # Start: Present the user with a list of timers to choose.
  111.  
  112. identifier=$(zenityNoWarn --list \
  113.  --title="Choose your timer" \
  114.  --column="Name" --column="Configuration" \
  115.   Normal 15-5-25 \
  116.   FiHeavy 45-10-25)
  117.  
  118. norm="Normal"
  119.  
  120. fiheavy="FiHeavy"
  121.  
  122. if [ "$identifier" = "$norm" ]; then
  123.     # They chose the Normal timer...
  124.     fitenormal
  125. fi
  126.  
  127. if [ "$identifier" = "$fiheavy" ]; then
  128.     # They chose the FiHeavy timer...
  129.     fiteheavy
  130. fi
Add Comment
Please, Sign In to add comment