Add hot-reload config support to detect and apply changes without restart

- Create ConfigWatcher module to monitor config.toml for modifications
- Add get_config_path() to consistently determine config file location
- Implement hot-reload detection in update() that checks for file changes each frame
- Add apply_config_changes() method to handle config updates gracefully
- Add PartialEq derive to all config structs to enable change detection
- Config changes now apply immediately without requiring app restart
- Background opacity, colors, text sizing, and other settings update live
- Log all detected changes for debugging and user awareness
- Fixes issue where config.toml changes were only applied when running from cargo run
This commit is contained in:
2026-02-06 12:23:28 +01:00
parent 64d707bd8b
commit 51811d4f57
6 changed files with 326 additions and 124 deletions
+2 -2
View File
@@ -3,7 +3,6 @@ width = 1024.0
height = 768.0
min_width = 800.0
min_height = 600.0
transparency = 1.0
use_transparency = true
position_offset_x = 0.0
position_offset_y = -30.0
@@ -23,7 +22,8 @@ secret_expiration_years = 50 # How many years until created secrets expire (def
# Leave empty to use embedded default background, or specify custom path
# Examples: "./assets/background.jpg", "C:/path/to/image.png"
background_image = "./assets/background.jpg"
background_opacity = 1.0
background_opacity = 0.8
fallback_color_opacity = 0.4
background_blur = 0.0
fallback_color = [30, 30, 40] # Used if image fails to load