Skip to content

Commit db40916

Browse files
authored
Added Pomodoro Timer (DhanushNehru#302)
* Added Pomodoro Timer * Update README.md * Update README.md
1 parent 215c7ce commit db40916

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

Diff for: Pomodoro Timer/Pomodoro Timer MacOS Linux.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Pomodoro Timer for macOS/Linux
2+
import time
3+
import os
4+
5+
def pomodoro_timer_unix(work_duration=25, break_duration=5, cycles=4):
6+
for cycle in range(cycles):
7+
print(f"Cycle {cycle + 1}/{cycles}: Start working for {work_duration} minutes.")
8+
time.sleep(work_duration * 60)
9+
os.system('echo -e "\a"') # Make a beep sound on macOS/Linux
10+
print("Time's up! Take a break.")
11+
12+
print(f"Break time! Relax for {break_duration} minutes.")
13+
time.sleep(break_duration * 60)
14+
os.system('echo -e "\a"') # Make a beep sound on macOS/Linux
15+
print("Break is over! Back to work.")
16+
17+
print("All cycles completed! Great job!")
18+
19+
if __name__ == "__main__":
20+
work_duration = int(input("Enter work duration in minutes (default is 25): ") or 25)
21+
break_duration = int(input("Enter break duration in minutes (default is 5): ") or 5)
22+
cycles = int(input("Enter number of cycles (default is 4): ") or 4)
23+
24+
pomodoro_timer_unix(work_duration, break_duration, cycles)

Diff for: Pomodoro Timer/Pomodoro Timer Windows.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Pomodoro Timer for Windows
2+
import time
3+
import winsound
4+
5+
def pomodoro_timer_windows(work_duration=25, break_duration=5, cycles=4):
6+
for cycle in range(cycles):
7+
print(f"Cycle {cycle + 1}/{cycles}: Start working for {work_duration} minutes.")
8+
time.sleep(work_duration * 60)
9+
winsound.Beep(1000, 1000) # Sound an alert to indicate work period end
10+
print("Time's up! Take a break.")
11+
12+
print(f"Break time! Relax for {break_duration} minutes.")
13+
time.sleep(break_duration * 60)
14+
winsound.Beep(1000, 1000) # Sound an alert to indicate break period end
15+
print("Break is over! Back to work.")
16+
17+
print("All cycles completed! Great job!")
18+
19+
if __name__ == "__main__":
20+
work_duration = int(input("Enter work duration in minutes (default is 25): ") or 25)
21+
break_duration = int(input("Enter break duration in minutes (default is 5): ") or 5)
22+
cycles = int(input("Enter number of cycles (default is 4): ") or 4)
23+
24+
pomodoro_timer_windows(work_duration, break_duration, cycles)

Diff for: Pomodoro Timer/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Pomodoro Timer
2+
## 📋 Overview
3+
The Pomodoro Timer is a productivity tool designed to help you manage your time efficiently using the Pomodoro Technique. It splits your work into intervals—typically 25 minutes of focused work followed by a 5-minute break. This cycle helps to boost focus and prevent burnout by encouraging regular breaks. The script is cross-platform, supporting both Windows and macOS/Linux.
4+
5+
## ✨ Features
6+
- **Customizable Work and Break Durations:** Set your preferred time for work and break sessions.
7+
- **Support for Multiple Cycles:** Run multiple Pomodoro sessions in a row.
8+
- **Platform-Specific Alerts:**
9+
- **Windows:** Uses sound alerts (winsound) to notify users when a session is complete.
10+
- **macOS/Linux:** Uses terminal beep commands for notifications.
11+
12+
## Running the script
13+
1. **Clone the Repository or Download the Script:**
14+
- clone the repository:
15+
```
16+
git clone https://github.com/max-lopzzz/Python-Scripts/tree/master/Pomodoro%20Timer
17+
```
18+
- Or download the script directly from the repository page.
19+
2. **Navigate to the Script Location:** Open your terminal (Command Prompt on Windows, Terminal on macOS/Linux) and navigate to the folder containing the script:
20+
```
21+
cd path/to/your/script
22+
```
23+
3. **Run the Script:** Execute the script using Python:
24+
```
25+
python pomodoro_timer.py
26+
```
27+
or, if `python` points to Python 2.x on your system:
28+
```
29+
python3 pomodoro_timer.py
30+
```
31+
### Customizing Durations
32+
- Once the script runs, it may prompt you to enter custom durations for both work and break intervals.
33+
- Simply follow the prompts to customize your session lengths.

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ More information on contributing and the general code of conduct for discussion
9797
| Playlist Exchange | [Playlist Exchange](https://github.com/DhanushNehru/Python-Scripts/tree/master/Playlist%20Exchange) | A Python script to exchange songs and playlists between Spotify and Python.
9898
| Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | The pigeonhole sort algorithm to sort your arrays efficiently!
9999
| PNG TO JPG CONVERTOR | [PNG-To-JPG](https://github.com/DhanushNehru/Python-Scripts/tree/master/PNG%20To%20JPG) | A PNG TO JPG IMAGE CONVERTOR.
100+
| Pomodoro Timer | [Pomodoro Timer](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pomodoro%20Timer) | A Pomodoro timer
100101
| Python GUI Notepad | [Python GUI Notepad](https://github.com/DhanushNehru/Python-Scripts/blob/master/PDF%20Merger%20and%20Splitter/PDF%20Merger%20and%20Splitter.py) | A Python-based GUI Notepad with essential features like saving, opening, editing text files, basic formatting, and a simple user interface for quick note-taking.
101102
| QR Code Generator | [QR Code Generator](https://github.com/DhanushNehru/Python-Scripts/tree/master/QR%20Code%20Generator) | This is generate a QR code from the provided link |
102103
| QR Code with logo | [QR code with Logo](https://github.com/DhanushNehru/Python-Scripts/tree/master/QR%20with%20Logo) | QR Code Customization Feature

0 commit comments

Comments
 (0)