Signed-off-by: Olivier 'reivilibre <git.contact@librepush.net>
Intention RS Slint
A simple focus timer application built with Slint and Rust. Set your intention, choose a duration, and the app will hide for that time before reappearing to ask for your next focus.
How It Works
The application uses a simple two-process architecture:
- Main Process: Handles the timer logic and repeatedly prompts for new tasks
- Prompt Process: Shows the UI window and returns user selection as JSON
Architecture
Parent Process (cargo run)
├── Calls child process with "prompt" argument
├── Receives JSON result (duration + focus text)
├── Sleeps for specified duration using std::thread::sleep()
└── Loops indefinitely until child process fails
Child Process (cargo run -- prompt)
├── Shows UI window
├── Captures user selection (duration button + text input)
├── Returns JSON result and exits
└── Clean, simple lifecycle
Usage
Normal Operation
cargo run
This starts the continuous timer loop. The app will:
- Show the prompt window
- Wait for you to enter a focus and select duration
- Hide for the selected time
- Reappear and repeat
Single Prompt Mode
cargo run -- prompt
This shows the UI once and returns the result as JSON:
{"duration_minutes":5,"focus_text":"Write documentation"}
Features
- Duration Options: 3m, 5m, 10m, 15m, 30m, 60m
- Keyboard Shortcuts: Alt-[1-6] for quick duration selection
- Always on Top: Window stays above other applications (Linux Wayland)
- Fresh State: Clean window each cycle
- Simple Timer: Uses reliable
std::thread::sleep()instead of complex UI timers - JSON Output: Structured data for integration with other tools
UI Layout
The prompt window contains:
- Title: "What will you focus on?"
- Text Input: Multiline field for your intention
- Duration Label: "For how long? (Alt-[1–6])"
- Duration Buttons: Six buttons in 2×3 grid (3m, 5m, 10m, 15m, 30m, 60m)
- Settings Icon: Top-right corner (placeholder for future features)
Keyboard Shortcuts
- Alt-1: 3 minutes
- Alt-2: 5 minutes
- Alt-3: 10 minutes
- Alt-4: 15 minutes
- Alt-5: 30 minutes
- Alt-6: 60 minutes
Development
Building
cargo check # Check compilation
cargo build # Build the application
cargo run # Run in normal mode
Dependencies
- slint: UI framework
- serde: JSON serialization/deserialization
- serde_json: JSON handling
Architecture Benefits
- No Complex Threading: Simple process-based approach avoids Slint threading issues
- Robust Timer: Uses system sleep instead of UI timers
- Clean State Management: Each prompt is a fresh process
- Easy Integration: JSON output enables scripting and automation
- Reliable: Process isolation prevents UI issues from affecting timer logic
Future Enhancements
- Capture and return actual text input content
- Add settings functionality
- Support for custom durations
- Timer pause/resume
- Statistics tracking
- Sound notifications
License
This project is open source. See LICENSE file for details.
Description
Clone of https://danieldelaney.net/intention/ (from https://danieldelaney.net/metacognition/)
Vibe-coded as an experiment. UI toolkit is Slint.
Languages
Slint
66.3%
Rust
24%
Nix
9.7%