Simple terminal-based timer application with clean architecture
FreeTimer is a lightweight, terminal-based timer application with a clean architecture designed for simplicity and ease of use. Perfect for Pomodoro technique, time management, or any task requiring multiple concurrent timers.
- β±οΈ Multiple concurrent timers - Run several timers simultaneously with independent controls
- π― Simple time format - Support for seconds, minutes, hours (e.g.,
90,45m,1h30m) - π Audio notifications - Sound alerts when timers start and finish
- π§΅ Thread-based execution - Each timer runs in its own thread for true concurrency
- π¨ Clean architecture - Simple, well-organized codebase
- π Mute support - Optional audio muting via command-line flag
- π Lightweight - Minimal dependencies
- Python 3.11 or higher
- uv (recommended) or pip
# Clone the repository
git clone https://github.com/frbelotto/FreeTimerAlert.git
cd FreeTimerAlert
# Install dependencies
uv sync
# Run the application
uv run python main.pyThe application runs entirely in the terminal. Use the following commands:
| Command | Arguments | Description |
|---|---|---|
create |
name, duration | Create a new timer |
list |
- | List all timers |
start |
name | Start a timer |
pause |
name | Toggle pause/resume |
reset |
name | Reset timer to initial duration |
add |
name, duration | Add time to a timer |
remove |
name | Remove finished/stopped timer |
FreeTimer accepts flexible time formats:
| Format | Example | Result |
|---|---|---|
| Seconds only | 90 |
90 seconds |
| Minutes | 45m |
45 minutes |
| Hours + Minutes | 1h30m |
1 hour 30 minutes |
| Explicit seconds | 30s |
30 seconds |
π Welcome to FreeTimer!
βΆοΈ create: Create timers (name, duration)
βΆοΈ start: Start timer (name)
...
β¨οΈ Enter command: create
Enter value for 'name' (text): focus
β° Accepted time formats...
Enter value for 'duration' (time (90, 45m, 1h30m, 30s)): 25m
β¨οΈ Enter command: start
Enter value for 'name' (text): focus
π’ Timer 'focus' started!
Time remaining: 0:24:59
...- Start sound:
Assets/Sounds/clock-start.mp3 - End sound:
Assets/Sounds/timer-terminer.mp3 - Disable audio: Use
--muteflag
Note: If your system lacks an audio backend (ALSA/PulseAudio on Linux), the application will continue to work and log a warning when attempting to play sounds. On Linux, you may need to install
gobjectandcairodevelopment libraries ifplaysound3requires them.
python main.py [OPTIONS]| Option | Description |
|---|---|
--debug |
Enable debug logging output |
--mute |
Disable sound notifications |
# Run with default settings
python main.py
# Run with debug logging
python main.py --debug
# Run without sound notifications
python main.py --mute
# Combine multiple options
python main.py --debug --muteFreeTimer follows a clean layered architecture with clear separation of concerns:
- Responsibility: Self-contained timer with complete lifecycle management
- Implementation: Python dataclass with threading support
- Manages: duration, remaining time, status, and its own execution thread
- Methods:
start(),pause(),resume(),stop(),reset(),add_time() - Thread-safe: Uses locks for all state modifications
- Responsibility: Coordinator for multiple named timers
- Manages: catalog of timers by name
- Methods:
create_timer(),start_timer(),stop_timer(),pause_or_resume_timer(),remove_timer() - Delegates: Forwards commands to individual timers
- Responsibility: User interaction and command processing
- Uses: match/case statements for command routing
- Configures: Sound notification callbacks during timer creation
- Functional module: Uses simple functions instead of classes
- Functions:
play_start_sound(),play_end_sound() - Handles: Audio playback with graceful error handling
flowchart TB
subgraph UI["π₯οΈ Terminal Interface"]
Terminal[Terminal Interface<br/>Command Processing]
end
subgraph Service["βοΈ Service Layer"]
TS[TimerService<br/>Timer Catalog<br/>Command Delegation]
end
subgraph Core["πΎ Self-Contained Timers"]
subgraph T1["Timer: work"]
T1D[Data: 25min<br/>Status: RUNNING]
T1T[Own thread]
end
subgraph T2["Timer: break"]
T2D[Data: 5min<br/>Status: PAUSED]
T2T[Own thread]
end
end
subgraph Notify["π Notifications"]
NS[Sound Functions<br/>play_start_sound<br/>play_end_sound]
end
Terminal --> TS
TS -->|delegates| T1
TS -->|delegates| T2
T1T -.->|internal tick| T1D
T2T -.->|paused| T2D
T1 -->|on_start/on_end| NS
T2 -->|on_start/on_end| NS
main.py # Entry point with CLI argument parsing
src/
core/
timer.py # Self-contained timer (dataclass + threading)
services/
timer_service.py # Multiple timer coordinator
logger.py # Logging configuration (functional)
parse_utils.py # Time parsing utilities
terminal/
interface.py # Terminal UI implementation
notifications.py # Sound notification functions
Assets/
Sounds/
clock-start.mp3 # Start notification sound
timer-terminer.mp3 # End notification sound
tests/
core/
test_timer.py # Timer unit tests
conftest.py # Pytest fixtures
services/
test_logger.py # Logger tests
test_timer_service.py # TimerService tests
test_parse_utils.py # Time parsing tests
# Run application
uv run python main.py
# Run with options
uv run python main.py --debug
uv run python main.py --mute
# Format code
uvx ruff format
# Lint code
uvx ruff check
# Run tests
uv run pytest tests/ -v
# Run tests with coverage
uv run pytest tests/ -v --cov=srcNote: Tests run with
FREETIMER_MUTE=1to suppress audio during testing.
The project follows these standards:
- Type hints: All functions include type annotations
- Docstrings: Descriptive documentation in English
- Logging: Structured logging via
logger(noprint()statements in core code) - Testing: Pytest with comprehensive test coverage
- Linting: Ruff for code style enforcement
- Minimal dependencies: Only essential libraries (playsound3, rich)
FreeTimer is designed to work across:
- β Linux (tested)
- β macOS
- β Windows
Contributions are welcome! Please ensure:
- Code follows project style (use
ruff formatandruff check) - All tests pass (
pytest tests/ -v) - New features include tests
- Documentation is updated
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) - see LICENSE file for details
Built with β€οΈ for productivity and time management