Fix floating window profile persistence and treat appearance/position/layer as global settings#89
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6ddf114b7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var scale = Math.Clamp(config.FloatingWindowScale, 0.5, 2.0); | ||
| var iconSize = Math.Clamp(config.FloatingWindowIconSize, 15, 50) * scale; | ||
| var textSize = Math.Clamp(config.FloatingWindowTextSize, 8, 30) * scale; | ||
| var opacity = Math.Clamp(config.FloatingWindowOpacity, 10, 100); |
There was a problem hiding this comment.
Migrate existing profile appearance settings
For users upgrading from a build that already wrote floating-window profile JSON, appearance and layer edits were saved only on FloatingWindowProfile via the old editor bindings; MigrateFromLegacyConfig() now returns as soon as Default.json exists and never copies those existing profile values back into MainConfigData. With these lines now rendering from _configHandler.Data, those users silently fall back to stale/default global scale/icon/text/opacity (and similarly layer/drag-handle settings) and the next profile save drops the old JSON fields, so their persisted settings are lost unless a one-time migration/backfill reads the current profile's old fields first.
Useful? React with 👍 / 👎.
Motivation
Description
FloatingWindowProfileand stop migrating them into profile JSON inFloatingWindowProfileManager.MigrateFromLegacyConfig()so profiles only contain button layout and rulesets.MainConfigData(_configHandler.Data) when rendering/updating the floating window and when saving window position or layer changes inFloatingWindowService(e.g.,EnsureWindow,RefreshWindowButtons,EnsureWindowPositionVisibleOnStartup,SavePosition,RecheckWindowLayer,SetWindowLayer,ToggleWindowLayer,RefreshLayerRecheckMode).GetConfiguredButtonRowsWithFallback()and using it in row rendering and visibility checks so new/unconfigured buttons are appended (and profile is saved where appropriate).SaveCurrentRulesetTarget()inFloatingWindowEditorSettingsPage.axaml.csand call it from ruleset property/collection change handlers and drawer toggles so button/row ruleset edits save the profile and window ruleset edits saveMainConfig.FloatingWindowEditorSettingsPage.axaml) to bind shared appearance/layer controls toViewModel.Settings(globalMainConfigData) instead of the per-profile object.ToggleFloatingWindowLayerActionto snapshot and read layer state from the globalMainConfigDatainstead of the profile.Testing
git diff --checkwith no whitespace errors. (passed)dotnet buildbut the runtime is not available in the environment so a full build/test could not be executed (dotnet: command not found). (not run)ConfigHandlers/FloatingWindowProfile.cs,ConfigHandlers/FloatingWindowProfileManager.cs,Services/FloatingWindowService.cs,SettingsPage/FloatingWindowEditorSettingsPage.axaml,SettingsPage/FloatingWindowEditorSettingsPage.axaml.cs, andActions/ToggleFloatingWindowLayerAction.cs.Codex Task