-
Notifications
You must be signed in to change notification settings - Fork 129
feat: hold-to-talk hotkey mode (1.0.01 / A1003) — closes #1 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a529b30
feat: add hold-to-talk hotkey mode (closes #1)
9031f30
test: update HotkeyEventTests for pressed/released split
f142514
chore: tag hold-to-talk build as 1.0.01 / A1003
38e76bf
fix: stop window-background drag eating text selection; add eye toggl…
ae42602
fix: stop pretending polish ran when it was skipped or errored
545f74b
feat(polish): make Structured mode prompt force a 1./1)/a. hierarchy
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import Foundation | ||
|
|
||
| public enum HotkeyMode: String, Codable, Sendable, Equatable, CaseIterable { | ||
| /// 按一次开始,按一次结束。短按门槛低、适合长口述。 | ||
| case toggle | ||
| /// 按住录音、松手即停。适合短促、连续的口播(同 Wispr Flow / Typeless 默认行为)。 | ||
| case hold | ||
|
|
||
| public var displayName: String { | ||
| switch self { | ||
| case .toggle: return "切换式" | ||
| case .hold: return "按住说话" | ||
| } | ||
| } | ||
|
|
||
| public var hint: String { | ||
| switch self { | ||
| case .toggle: return "按一次开始录音,再按一次结束。" | ||
| case .hold: return "按住快捷键说话,松开立即停止。适合短句。" | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import Foundation | ||
|
|
||
| public enum HotkeyEvent: Sendable, Equatable { | ||
| /// Toggle 模式下:每次触发键按下时触发一次。 | ||
| case toggled | ||
| /// 录音中按 Esc | ||
| /// 触发键按下边沿。toggle 模式下解释为「开始/结束」翻转,hold 模式下解释为「开始」。 | ||
| case pressed | ||
| /// 触发键松开边沿。toggle 模式忽略;hold 模式解释为「结束」。 | ||
| case released | ||
| /// 录音中按 Esc。 | ||
| case cancelled | ||
| } |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Cancelling from
.startingin hold mode setssuppressNextRelease, which will suppress the next legitimate release and prevent the next session from ending.In this path,
handleReleasedcallshandleCancel()while in.startinghold mode. By then the key is already up and the corresponding.releasedhas been handled, buthandleCancel()still setssuppressNextRelease = true. That flag then incorrectly applies to the next press/release cycle, causing the next.releasedto be ignored and the subsequent hold session to never exit.listening/.processing. To avoid this, the.startingearly-release path should cancel without settingsuppressNextRelease, orhandleCancelshould only set this flag when invoked while the key is actually still down (e.g., Esc-based cancel).