Skip to content

Instantly share code, notes, and snippets.

@bashbunni
Last active September 17, 2025 18:28
Show Gist options
  • Save bashbunni/f6b04fc4703903a71ce9f70c58345106 to your computer and use it in GitHub Desktop.
Save bashbunni/f6b04fc4703903a71ce9f70c58345106 to your computer and use it in GitHub Desktop.
CLI Pomodoro for Mac
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
alias rest="timer 10m && terminal-notifier -message 'Pomodoro'\
-title 'Break is over! Get back to work 😬'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
# Use a pomodoro timer with the fish shell.
# This requires https://github.com/caarlos0/timer to be installed and https://github.com/charmbracelet/gum on PATH
function pom
set split $POMO_SPLIT
if ! test -n "$split"
set split $(gum choose "25/5" "50/10" "all done" --header "Choose a pomodoro split.")
end
switch $split
case '25/5'
set work "25m"
set break "5m"
case '50/10'
set work "50m"
set break "10m"
case 'all done'
return
end
timer $work && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-sound Crystal
gum confirm "Ready for a break?" && \
timer $break && terminal-notifier -message 'Pomodoro'\
-title 'Break is over! Get back to work 😬'\
-sound Crystal \
|| pom
end
@rafaeltenoriogama
Copy link

Sorry I'm late to the game here. So do you just sacrifice a terminal when you run this? Or you ctrl-z + bg your work alias so you can still use the terminal? When I saw the youtube I was imagining it would adjust the prompt or something.

Brother you need to use Tmux or smth like that to split the terminal and work on the same window. Otherwise, yes, you will sacrifice one terminal window just for this.

Example of how Tmux works:
image

@michael-duren
Copy link

michael-duren commented Jun 6, 2025

In case anyone else wanted this. Added functions for specifying the time.

Use:
w 50 # work 50 minutes

# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
        -title 'Work Timer is up! Take a Break 😊'\
        -appIcon '~/Pictures/pumpkin.jpg'\
        -sound Crystal"
        
alias rest="timer 10m && terminal-notifier -message 'Pomodoro'\
        -title 'Break is over! Get back to work 😬'\
        -appIcon '~/Pictures/pumpkin.jpg'\
        -sound Crystal"

w() {
    timer "${1}m" && terminal-notifier -message 'Pomodoro'\
        -title 'Work Timer is up! Take a Break 😊'\
        -appIcon '~/Pictures/pumpkin.jpg'\
        -sound Crystal
}

r() {
    timer "${1}m" && terminal-notifier -message 'Pomodoro'\
        -title 'Break is over! Get back to work 😬'\
        -appIcon '~/Pictures/pumpkin.jpg'\
        -sound Crystal
}

@nameerakhter
Copy link

for those who want to use this on windows here is a workaround you can add the following code to your powershell profile

Screenshot 2025-08-11 130250

Requires https://github.com/caarlos0/timer to be installed

# --- The Main Function ---
function Start-PomoTimer {
    param (
        [string]$TimerType
    )

    $pomoOptions = @{
        "work"  = "50m"
        "break" = "10m"
        "short" = "5m"
    }

    # --- REMEMBER TO UPDATE THIS PATH WITH THE PATH WHERE YOU CLONED THE REPO MENTIONED ABOVE ---
    $timerPath = "D:\timer\timer.exe"

    if ($pomoOptions.ContainsKey($TimerType)) {
        $duration = $pomoOptions[$TimerType]
        Write-Host "Starting '$TimerType' timer for $duration..."
        & $timerPath $duration -n $TimerType
        Write-Host "'$TimerType' session done!"
    } else {
        Write-Host "Invalid timer type: '$TimerType'. Available types: $($pomoOptions.Keys -join ', ')"
    }
}

function Start-PomoWork {
    Start-PomoTimer -TimerType "work"
}

function Start-PomoBreak {
    Start-PomoTimer -TimerType "break"
}


# --- Updated Aliases pointing to the new functions ---
Set-Alias -Name wo -Value Start-PomoWork
Set-Alias -Name br -Value Start-PomoBreak

@Bahaaio
Copy link

Bahaaio commented Aug 16, 2025

Nice setup! I built a Go CLI tool inspired by this approach - handles notifications and timing with a simple config file:
https://github.com/Bahaaio/pomo

you can do:

  • pomo (work session)
  • pomo 15m (custom duration)
  • pomo break

Is cross-platform (Linux, macOS, Windows).
Includes pause/resume, add/subtract time, and reset functionality.

pomo

example notification config:

notification:
    enabled: true
    title: work finished πŸŽ‰
    message: time to take a break
    icon: ~/my/icon.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment