The Pomodoro technique is widely used by technology professionals to enhance productivity and maintain focus during long work or study sessions. This Bash script implements an automated Pomodoro cycle, providing visual and sound notifications to guide the user through focus and break sessions.
The script operates in cycles of 25 minutes of concentration, followed by short 5-minute breaks. After four cycles, it triggers a long 15-minute break. The execution is continuous, ensuring the user stays on track without needing to restart the timer manually.
To facilitate interaction, the script utilizes notify-send for notifications, paplay for sound alerts, and zenity for informational dialog boxes. This approach minimizes workflow interruptions, ensuring smooth and efficient transitions between focus and rest periods.
Experts who need a simple and effective method to manage their productivity can benefit from this automated solution, which integrates directly into the Linux environment without relying on complex external applications.
pomodoro.sh
#!/bin/bash
# Time definitions (in seconds)
POMODORO=1500 # 25 minutes of focus
SHORT_BREAK=300 # 5-minute break
LONG_BREAK=900 # 15-minute break after 4 cycles
CYCLES=0
while true; do
((CYCLES++))
# 🎯 Focus Time
notify-send "🔴 Pomodoro started!" "Focus for 25 minutes."
sleep $POMODORO
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
zenity --info --title="Pomodoro" --text="⏳ Time's up! Time for a break." --width=300 --height=100
# If 4 cycles are completed, take a long break
if ((CYCLES % 4 == 0)); then
notify-send "🌿 Long Break!" "Rest for 15 minutes."
sleep $LONG_BREAK
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
zenity --info --title="Pomodoro" --text="🏁 Long break over! Get back to work." --width=300 --height=100
else
# 🚀 Short Break
notify-send "☕ Short Break!" "Relax for 5 minutes."
sleep $SHORT_BREAK
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
zenity --info --title="Pomodoro" --text="🎯 Short break over! Get ready for the next cycle." --width=300 --height=100
fi
done
Top comments (0)