State-mutation core for create_profile. AppHandle-free so the
validation + copy + push + persist path can be unit-tested without
a Tauri runtime; the command wrapper layers the profile:changed
emit on top.
Copy sourceβs settings into a brand-new profile named name
without flipping the active profile. Avoids the
switch-then-create dance that used to fire profile:changed
mid-duplication and clobber unsaved hook drafts.
Reorder profiles to match names exactly. The renderer sends the
full list β the call rejects length mismatches, duplicates, and
unknown names rather than try to merge.
Replace nameβs settings with Settings::default(). If name is
the active profile, the in-memory settings are also reset so the
renderer sees the change without a profile switch.
State-mutation core for reset_profile_to_defaults. Replaces the
named profileβs settings with Settings::default(), and also resets
the in-memory live settings slot when the named profile is active.
Switch the active profile to name. Shared by the Tauri command,
the tray-menu handler, and the local-IPC entry point. Resets the
per-profile timers (keeping last_sleep) and emits profile:changed.