Skip to content

feat: add tray floating-window toggle and local quote playback order#72

Merged
Programmer-MrWang merged 2 commits into
mainfrom
codex/investigate-clean-garbage-feature-implementation
May 8, 2026
Merged

feat: add tray floating-window toggle and local quote playback order#72
Programmer-MrWang merged 2 commits into
mainfrom
codex/investigate-clean-garbage-feature-implementation

Conversation

@Programmer-MrWang
Copy link
Copy Markdown
Owner

Motivation

  • Provide a tray-menu toggle for the floating window so users can 显示/隐藏悬浮窗 from the system tray and keep that control synchronized with the main settings page.
  • Follow the pattern used by DutyIsland (manipulating ITaskBarIconService.MoreOptionsMenuItems) to register/unregister tray items only when the floating-window feature is enabled.
  • Extend the "本地一言" component with a user-selectable playback order so text lines can be played sequentially (existing behavior) or randomly.

Description

  • Add tray integration in Plugin.cs: implement RegisterOrUpdateFloatingWindowTrayMenu, UnregisterFloatingWindowTrayMenu, OnMainConfigDataPropertyChanged, and UpdateFloatingWindowTrayMenuHeader, and call registration on startup and unregistration on stop; the tray item toggles MainConfigData.ShowFloatingWindow, calls FloatingWindowService.UpdateWindowState(), and persists the config.
  • Add LocalQuotePlaybackOrder enum and PlaybackOrder observable property in Models/ComponentSettings/LocalQuoteSettings.cs with default Sequential.
  • Update settings UI and control: add a 轮播顺序 settings expander (icon E143) and a ComboBox bound to the new enum in Controls/Components/LocalQuoteSettingsControl.axaml and expose PlaybackOrders in the control code-behind.
  • Update LocalQuoteComponent runtime logic to support random playback by adding a Random instance, responding to PlaybackOrder changes, and choosing a random index when PlaybackOrder == LocalQuotePlaybackOrder.Random while preserving existing sequential behavior and persistence semantics.

Testing

  • Attempted an automated build with dotnet build -v minimal, but the execution environment does not have dotnet installed so the build could not be performed (failed).
  • No other automated test suites were executed in this environment; changes were staged and committed locally (git commit succeeded).

Codex Task

@Programmer-MrWang Programmer-MrWang merged commit 2d1dda4 into main May 8, 2026
1 check passed
@Programmer-MrWang Programmer-MrWang deleted the codex/investigate-clean-garbage-feature-implementation branch May 8, 2026 16:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0f0a0b82a

ℹ️ 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".

Comment thread Plugin.cs
Comment on lines +943 to +946
var trayService = IAppHost.TryGetService<ITaskBarIconService>();
if (trayService == null)
{
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retry tray menu registration when service is temporarily null

RegisterOrUpdateFloatingWindowTrayMenu exits immediately when IAppHost.TryGetService<ITaskBarIconService>() returns null, but this method is only invoked at startup and on floating-window config changes. In startup orders where the tray service is not ready yet, the menu item is never added for the entire session unless the user later toggles ShowFloatingWindow/EnableFloatingWindowFeature, so the new tray toggle silently disappears for affected users.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant