Skip to content

feat(trigger-icon): add hover/click activation mode option#73

Merged
yusixian merged 1 commit into
mainfrom
feat/trigger-activation-mode
May 26, 2026
Merged

feat(trigger-icon): add hover/click activation mode option#73
yusixian merged 1 commit into
mainfrom
feat/trigger-activation-mode

Conversation

@yusixian

Copy link
Copy Markdown
Collaborator

Summary

  • Add TriggerActivationMode enum (.hover default / .click) + Defaults.Keys.triggerActivationMode.
  • TriggerIconController reads mode at show time. Hover mode keeps the existing 0.3s hover-timer path; click mode skips it — mouseEntered pauses auto-dismiss while the cursor is over the icon, and mouseExited restarts the 3s auto-dismiss so the icon eventually disappears if the user never clicks. mouseDown always triggers translation.
  • New Floating Icon Activation: Picker in General settings, exposed under the existing auto-detect toggle.
  • Localized new strings (Hover / Click / Floating Icon Activation:) for en + zh-Hans.

Closes #58

Test plan

  • Default behavior unchanged: hover for 0.3s over the floating icon triggers translation.
  • Switch Floating Icon Activation to Click: hovering does not trigger; clicking does.
  • In click mode, idle hover over the icon pauses the 3s auto-dismiss timer; moving away restarts it.
  • Setting persists across relaunch (verified via Defaults).
  • zh-Hans locale shows 悬浮球触发方式: / 悬停 / 点击.

@yusixian yusixian self-assigned this May 26, 2026
@yusixian yusixian added the enhancement New feature or request label May 26, 2026
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
yusixian force-pushed the feat/trigger-activation-mode branch from 2d1bb26 to 36f79ef Compare May 26, 2026 13:04
@yusixian
yusixian requested a review from Copilot May 26, 2026 13:04
@yusixian
yusixian merged commit 470ba22 into main May 26, 2026
1 check failed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 via Defaults.Keys.triggerActivationMode.
  • Updates TriggerIconController to 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.

Comment thread Sources/UI/TriggerIcon/TriggerIconController.swift
@yusixian
yusixian deleted the feat/trigger-activation-mode branch May 26, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

功能建议:增加悬浮球翻译触发方式选项

2 participants