feat(trigger-icon): add hover/click activation mode option#73
Merged
Conversation
Add TriggerActivationMode preference (default .hover) so users can choose whether the floating translation icon triggers on hover or only on click. Click mode pauses auto-dismiss while the cursor is over the icon and restarts it on exit so the icon eventually disappears if the user never clicks. Closes #58
yusixian
force-pushed
the
feat/trigger-activation-mode
branch
from
May 26, 2026 13:04
2d1bb26 to
36f79ef
Compare
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable activation mode for the floating trigger icon so users can choose between hover-to-translate (current default) and click-to-translate, addressing the feature request in #58.
Changes:
- Introduces
TriggerActivationMode(hover/click) persisted viaDefaults.Keys.triggerActivationMode. - Updates
TriggerIconControllerto branch hover vs click behavior (hover timer vs click activation + hover pauses auto-dismiss). - Adds a new “Floating Icon Activation:” picker in General settings and localizes the new UI strings (en key + zh-Hans values).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Sources/Utilities/Constants.swift | Adds TriggerActivationMode and a new Defaults key to persist the setting. |
| Sources/UI/TriggerIcon/TriggerIconController.swift | Applies activation mode to hover/click tracking behavior for the trigger icon. |
| Sources/UI/Settings/GeneralSettingsView.swift | Exposes activation mode as a user setting via a Picker. |
| Resources/Localizable.xcstrings | Adds zh-Hans translations for the new activation-mode strings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
TriggerActivationModeenum (.hoverdefault /.click) +Defaults.Keys.triggerActivationMode.TriggerIconControllerreads mode at show time. Hover mode keeps the existing 0.3s hover-timer path; click mode skips it —mouseEnteredpauses auto-dismiss while the cursor is over the icon, andmouseExitedrestarts the 3s auto-dismiss so the icon eventually disappears if the user never clicks.mouseDownalways triggers translation.Floating Icon Activation:Picker in General settings, exposed under the existing auto-detect toggle.Hover/Click/Floating Icon Activation:) for en + zh-Hans.Closes #58
Test plan
Floating Icon ActivationtoClick: hovering does not trigger; clicking does.Defaults).悬浮球触发方式:/悬停/点击.