feat(sync): device profiles carry their own sync_path; remove inert match_path_contains - #265
Merged
Merged
Conversation
Add an optional sync_path to DeviceProfile. Activating a profile (via :set-device-profile or for active_device_profile at startup) sets the Sync buffer's active sync target to that path, so switching profiles points the target at the right device every time. Manual selection keeps session-level precedence: p / picking a saved target still overrides the active target without rewriting the profile, and re-running :set-device-profile snaps it back to the configured path. An unavailable path (device unplugged) is still applied with a heads-up message. A profile switch does not bump saved-target use_count. Remove the inert match_path_contains field (never read anywhere; superseded by sync_path). Existing config.json is unaffected — the key is ignored on load. Docs: DEVICE_PROFILES.md, KEYBINDINGS.md, README, CHANGELOG. Closes #264 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Device profiles can now carry their own
sync_path. Activating a profile points the Sync buffer's active sync target at that device — so switching to your FiiO profile targets the FiiO, switching to the Innioasis targets the Innioasis, every time.Closes #264.
What changed
src/config.rs— Addedsync_path: Option<String>(#[serde(default)]) toDeviceProfile. Removed the inertmatch_path_containsfield (it was never read by any logic — a placeholder for auto-selection that's now superseded bysync_path).src/ui/app.rs— Newapply_profile_sync_targethelper, called fromset_device_profile_directand the two startup buffer-creation sites. Switching to a profile with async_pathsets the active sync target to it.Behavior
:set-device-profile <name>always re-applies the profile'ssync_path(and at startup foractive_device_profile).p(pick directory) or selecting a saved target still overrides the active target, and does not rewrite the profile'ssync_path. Re-running:set-device-profilesnaps back to the configured path.sync_pathleaves the active target unchanged.use_count(stays "real syncs only").sync_pathis authored inconfig.json, like the rest of a profile.Compatibility
Existing
config.jsonfiles are unaffected:DeviceProfilehas nodeny_unknown_fields, so a leftovermatch_path_containskey is ignored on load.Tests
New unit tests (all pass): switch applies the target; no-
sync_pathleaves it unchanged; an unavailable path still sets the target; a manual override followed by re-switch resets to the configured path; config round-tripssync_path.cargo fmt --check,cargo clippy -- -D warnings, andcargo test(708 lib tests) all clean.Docs
docs/DEVICE_PROFILES.md(schema row + worked example + a "Sync target follows the profile" section),docs/KEYBINDINGS.md,README.md, andCHANGELOG.md.