Skip to content

Commit 6909f17

Browse files
sassmanclaude
andauthored
feat: add config file with profiles support (#295)
## Summary This PR adds support for a configuration file with named profiles, making it easy to save and reuse your favorite t-rec settings. ### New Features - **Config file support**: Save your default settings in `~/.config/t-rec/config.toml` (or local `t-rec.toml`) - **Named profiles**: Create different presets for various use cases (e.g., `demo`, `quick`, `presentation`) - **Easy setup**: Run `t-rec --init-config` to create a starter config file - **Profile discovery**: Use `t-rec --list-profiles` to see available profiles - **Home directory expansion**: Use `$HOME` in wallpaper paths for portability ### Usage Examples ```bash # Create a starter config file t-rec --init-config # Use a named profile t-rec --profile demo # List available profiles t-rec --list-profiles ``` ### Example Config File ```toml # Default settings applied to all recordings [default] wallpaper = "ventura" wallpaper-padding = 60 # Named profiles for different use cases [profiles.demo] wallpaper = "ventura" wallpaper-padding = 100 start-pause = "5s" idle-pause = "5s" [profiles.quick] quiet = true idle-pause = "1s" [profiles.custom] wallpaper = "$HOME/Pictures/my-wallpaper.png" wallpaper-padding = 80 ``` ### Supported Settings All CLI options can be set in the config file: - `wallpaper` - Background wallpaper (built-in name or path) - `wallpaper-padding` - Padding around the recording (1-500px) - `decor` - Border decoration style (`shadow` or `none`) - `bg` - Background color (`white`, `black`, `transparent`) - `quiet` - Suppress the Ctrl+D banner - `verbose` - Enable verbose output - `video` / `video-only` - Generate MP4 video - `natural` - Disable idle detection - `start-pause` / `end-pause` / `idle-pause` - Timing controls - `output` - Output file name ### Priority Order Settings are applied in this order (later values override earlier): 1. Built-in defaults 2. Config file `[default]` section 3. Config file `[profiles.<name>]` section (if `--profile` used) 4. CLI arguments ## Test plan - [x] `cargo build` succeeds - [x] `cargo test` passes (17 tests) - [x] `cargo clippy` passes - [x] Manual test: `t-rec --init-config` creates config file - [x] Manual test: `t-rec --list-profiles` shows profiles - [x] Manual test: `t-rec --profile demo` uses profile settings - [x] Manual test: CLI args override profile settings Closes #293 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ca2d658 commit 6909f17

File tree

11 files changed

+853
-24
lines changed

11 files changed

+853
-24
lines changed

Cargo.lock

Lines changed: 251 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)