Created
February 11, 2025 17:35
-
-
Save simonewebdesign/8e85e9fc86e0d53748f92adf7caa647d to your computer and use it in GitHub Desktop.
Revisions
-
simonewebdesign created this gist
Feb 11, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #!/bin/bash # Function to send a macOS notification send_notification() { osascript -e 'display notification "'"$1"'" with title "'"$2"'"' } # Function to display a countdown in the terminal countdown_timer() { local time_left=$1 local phase=$2 while [ $time_left -gt 0 ]; do # Display remaining time in the terminal echo -ne "$phase Timer: $((time_left / 60))m $((time_left % 60))s remaining\r" sleep 1 ((time_left--)) done echo -ne "\n$phase Timer: Time's up!\n" } # Timer settings (Pomodoro: 25 minutes work and 5 minutes break) WORK_TIME=25 BREAK_TIME=5 # Function to run the Pomodoro timer with countdown and notifications pomodoro_timer() { # echo "Starting Pomodoro timer for $WORK_TIME minutes..." # Work timer countdown countdown_timer $((WORK_TIME * 60)) "Work" send_notification "Time's up! Take a break!" "Pomodoro Timer" # Break timer countdown echo "Starting break time for $BREAK_TIME minutes..." countdown_timer $((BREAK_TIME * 60)) "Break" send_notification "Break is over! Back to work!" "Pomodoro Timer" } # Start the Pomodoro timer pomodoro_timer