diff --git a/Cargo.lock b/Cargo.lock
index bd20c1a..80cb8cb 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -33,6 +33,7 @@ dependencies = [
"anyhow",
"config",
"ctrlc",
+ "futures",
"grim-rs",
"image",
"image-compare",
@@ -861,6 +862,21 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
+[[package]]
+name = "futures"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-channel"
version = "0.3.32"
@@ -868,6 +884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"
dependencies = [
"futures-core",
+ "futures-sink",
]
[[package]]
@@ -876,6 +893,34 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+[[package]]
+name = "futures-executor"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
+
+[[package]]
+name = "futures-macro"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "futures-sink"
version = "0.3.32"
@@ -894,8 +939,13 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
dependencies = [
+ "futures-channel",
"futures-core",
+ "futures-io",
+ "futures-macro",
+ "futures-sink",
"futures-task",
+ "memchr",
"pin-project-lite",
"slab",
]
diff --git a/Cargo.toml b/Cargo.toml
index a8edd5e..437252c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,6 +7,7 @@ edition = "2021"
anyhow = "1.0"
config = "0.15.21"
ctrlc = "3.5.2"
+futures = "0.3"
grim-rs = "0.1.6"
image = "0.25.10"
image-compare = "0.5.0"
diff --git a/README.md b/README.md
index 18c3531..fd688e6 100644
--- a/README.md
+++ b/README.md
@@ -78,3 +78,103 @@ nix develop -c cargo run --release
3. **Analyze:** Calculates the dominant color of the current frame using the Oklab color space.
4. **Smooth:** Blends the new dominant color with the previous one based on the `smoothing` factor.
5. **Update:** Constructs a highly specific JSON payload for Home Assistant, ensuring white channels and brightness are preserved, and sends it asynchronously via `reqwest`.
+
+
+
+# TODO: Parallel Event Loop Restructuring
+
+## Architecture Overview
+
+```
+┌─────────────────────────────────────────────────────────────┐
+│ Shared State │
+│ │
+│ current_screenshot ← Latest captured (screenshot loop) │
+│ active_screenshot ← Screenshot that produced target_color│
+│ target_color ← Color calculated from active_screenshot│
+│ active_color ← Smoothed color sent to lights │
+└─────────────────────────────────────────────────────────────┘
+
+Data Flow:
+
+Screenshot Loop (screenshot_fps) Color Calc (on-demand)
+ │ │
+ ▼ ▼
+ [current_screenshot] [target_color]
+ │ │
+ │ diff(current, active) │
+ │ > min_diff_percent? │
+ ▼ │
+ [active_screenshot] ◄───────────────────────┘
+ │ │
+ │ Smoothing Loop (target_fps)│
+ │ │ │
+ │ ▼ │
+ │ [active_color] ◄─────────┘
+ │ │
+ ▼ ▼
+ Light Update (parallel to all lights)
+```
+
+## Implementation Tasks
+
+### Phase 1: Settings Update (`settings.rs`)
+- Add `screenshot_fps` config option (default: 3)
+- Remove `transition` option (smoothing handles transitions)
+
+### Phase 2: Create Shared State (`state.rs`)
+```rust
+pub struct AppState {
+ pub current_screenshot: RwLock