summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-07-15 23:40:13 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-07-15 23:40:13 +0530
commit8a07ac5ad345d44b516171a38da8020b0b6b1714 (patch)
tree4bd3ba1dc1f42affdd634fc2770cb8534afea980
Initial commit
-rw-r--r--LICENSE21
-rw-r--r--README.md11
-rwxr-xr-xbashmodoro.sh58
3 files changed, 90 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b045ee2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Saumit Dinesan
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..71fe942
--- /dev/null
+++ b/README.md
@@ -0,0 +1,11 @@
+# BashModoro: Pomodoro with Quote Notifier
+
+BashModoro is a minimalist and efficient time management tool for Linux, designed to help users enhance productivity and maintain focus during work sessions using the renowned Pomodoro Technique. Built upon the Unix philosophy of "Do one thing and do it well," the script leverages simple Unix commands, ensuring a minimalistic and effective approach to time management.
+It also notifies the users when Work session or Breaks are over via `notify-send`
+
+## Features
+**Sound Customization:** The script expects sound files to be organized in subdirectories within the soundfolder directory. Users can store custom sound files for pre-work, post-work, and post-break intervals, making the Pomodoro experience more personalized.
+
+**Timer and Session Management:** The script uses the timer command to manage work and break sessions. Users can specify the number of repetitions for each session type. The script also handles the sequence of work and break sessions appropriately.
+
+**Quote and Sound Notifications:** During the Pomodoro sessions, the script displays colored and stylized session information using lolcat, adding a touch of creativity to the experience. Additionally, it utilizes notify-send to display notifications with motivational quotes and reads them out custom quotes at the end of each session.
diff --git a/bashmodoro.sh b/bashmodoro.sh
new file mode 100755
index 0000000..290208b
--- /dev/null
+++ b/bashmodoro.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# Dependency check
+[ $(command -v timer) ] || { echo "Please install timer"; exit 1; }
+[ $(command -v lolcat) ] || { echo "Please install lolcat"; exit 1; }
+
+# Folder with subdirectories pre-work,post-work,post-break
+# with custom sound files in the format Person-Quote.wav
+soundfolder="$HOME/.local/share/voices"
+
+declare -A pomo_options
+pomo_options["work"]="25"
+pomo_options["break"]="5"
+
+# Check if a valid option is provided
+if [ -z "$1" ] || [ -z "${pomo_options[$1]}" ]; then
+ echo "Please provide a valid option: work or break."
+ exit 1
+fi
+
+val="$1"
+reps=${2:-1} # if 2nd argument(repetitions) not provided by default it's 1
+
+# Determine the starting session type
+if [ "$1" == "work" ]; then
+ sessions=("work" "break")
+else
+ sessions=("break" "work")
+fi
+
+# Run the timer and print a message when it's done
+for (( i=1; i<=reps; i++ )); do
+ for session in "${sessions[@]}"; do
+ if [ "$session" == "work" ]; then
+ # If first work-rep play pre-work sound
+ if [ $i -eq 1 ]; then
+ pre_work_sound=$(find "$soundfolder/pre-work" -type f | shuf -n 1) # Person-Quote.wav
+ title="${pre_work_sound##*/}" # Extract filename without directory
+ quote="${pre_work_sound##*-}" # Extract the part after hypher
+ notify-send "${title%%-*}" "${quote%.wav}" # Extract before hyphen, Remove .wav extension
+ paplay "$pre_work_sound"
+ fi
+ # Assign post-work sound
+ sound_file=$(find "$soundfolder/post-work" -type f | shuf -n 1) # Person-Quote.wav
+ else
+ # Else assign post-break sound
+ if [ $i -ne $reps ]; then
+ sound_file=$(find "$soundfolder/post-break" -type f | shuf -n 1) # Person-Quote.wav
+ fi
+ fi
+ echo "Pomodoro $i: $session" | lolcat
+ timer "${pomo_options[$session]}"m no_audio
+ # Play a sound when each timer ends
+ sound_file_name="${sound_file##*/}" # Extract filename without directory
+ notify-send "${sound_file_name%%-*}" "$(echo "${sound_file_name#*-}" | sed 's/\.wav$//')" # Person: Quote
+ paplay "$sound_file"
+ done
+done