-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add visual feedback when Force Release Stuck Drag is clicked #81
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -608,6 +608,30 @@ class MenuBarController: NSObject { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @objc func forceReleaseStuckDrag() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| multitouchManager?.forceReleaseStuckDrag() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Provide visual feedback that the action was triggered | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Flash the status bar icon briefly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flashStatusBarIcon() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Flash the status bar icon to provide visual feedback for actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private func flashStatusBarIcon() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let button = statusItem?.button else { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Store original image | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let originalImage = button.image | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Flash to a highlighted state (use template rendering) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if let image = originalImage { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let highlightedImage = image.copy() as? NSImage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| highlightedImage?.isTemplate = false // Make it appear "active" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| button.image = highlightedImage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Restore after a brief delay | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| button.image = originalImage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+621
to
+634
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Store original image | |
| let originalImage = button.image | |
| // Flash to a highlighted state (use template rendering) | |
| if let image = originalImage { | |
| let highlightedImage = image.copy() as? NSImage | |
| highlightedImage?.isTemplate = false // Make it appear "active" | |
| button.image = highlightedImage | |
| } | |
| // Restore after a brief delay | |
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { | |
| button.image = originalImage | |
| } | |
| // Use a brief alpha animation for visual feedback, consistent with updateStatusIcon | |
| NSAnimationContext.runAnimationGroup { context in | |
| context.duration = 0.15 | |
| button.animator().alphaValue = 0.3 | |
| } completionHandler: { | |
| NSAnimationContext.runAnimationGroup { context in | |
| context.duration = 0.15 | |
| button.animator().alphaValue = 1.0 | |
| } | |
| } |
Copilot
AI
Jan 23, 2026
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.
The new flashStatusBarIcon method lacks test coverage. The MenuBarControllerTests file contains tests for other UI methods like updateStatusIcon (lines 70-83), but there's no test for this new visual feedback functionality. Given that the repository has comprehensive test coverage for UI components, this method should have tests to verify it doesn't crash and handles edge cases like rapid clicks.
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.
The flash effect implementation has a fundamental issue: setting
isTemplate = falseon a copy of an already-template image doesn't produce a visible change. Template images are rendered using the system's accent color, and copying the image and changing this property doesn't make it appear different to the user.For a visible flash effect, consider using an alpha animation (similar to the pattern in
updateStatusIconat lines 51-59) or changing the image to a different symbol temporarily.