Skip to content

Conversation

@luciodaou
Copy link
Contributor

Description

General improvement with revised binary code and Raycast extension options of "Where's My Cursor" extension.

This extension is based on a small swift program, that was thoroughly revised, with the code still available.
The Raycast extension allows for quick running the program through hotkeys, and also turning the effect off. It also allows for an easy way to run the Custom mode, so the user can quickly configure opacity and colors of the elements.

Screencast

default_mode

presentation_mode

custom_mode

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: where-is-my-cursor Issues related to the where-is-my-cursor extension OP is author The OP of the PR is the author of the extension labels Aug 23, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Aug 23, 2025

Thank you for your contribution! 🎉

🔔 @luciodaou you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

Due to our current reduced availability during summer, the initial review may take up to 10-15 business days.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR represents a complete overhaul of the "Where Is My Cursor?" extension, transforming it from a simple single-command utility into a comprehensive cursor location suite with multiple modes and customization options. The changes include:

New Command Structure: The extension now provides 5 distinct commands instead of 1:

  • Main cursor location command (default mode)
  • Simple mode for basic highlighting
  • Presentation mode with screen dimming and spotlight effect
  • Custom mode with a form interface for user configuration
  • Off command to manually disable the cursor highlight

Enhanced Swift Binary: The underlying LocateCursor Swift application has been completely rewritten with:

  • JSON-based configuration system supporting dynamic parameters
  • Multiple preset modes (default, presentation, simple)
  • Real-time mouse tracking with escape key termination
  • Process management with lock files to prevent multiple instances
  • Configurable visual effects including opacity, colors, duration, and borders

Improved User Interface: Each command now includes subtitles following the pattern "Where Is My Cursor? - [Command Purpose]" for better organization in Raycast. The custom mode uses a view-based form allowing users to configure duration, screen opacity, circle appearance, and optional borders with both predefined and hex color options.

Better Documentation: The README has been significantly expanded with detailed feature descriptions, setup instructions, and privacy information, making the extension more user-friendly and professional.

PR Description Notes:

  • Minor typo: "where's the cursors at" should be "where the cursor is"

Important Files Changed

File Changes Summary
Filename Score Overview
extensions/where-is-my-cursor/src/main.tsx 1/5 CRITICAL: File is completely empty, breaking the entire extension
extensions/where-is-my-cursor/src/where-is-my-cursor.tsx 2/5 Main command lacks proper error handling and try-catch wrapper
extensions/where-is-my-cursor/src/simple-mode.tsx 3/5 Simple mode command with basic exec implementation
extensions/where-is-my-cursor/CHANGELOG.md 3/5 Missing required {PR_MERGE_DATE} template string in title
extensions/where-is-my-cursor/assets/LocateCursor 3/5 Binary file replacement - cannot verify functionality through code review
extensions/where-is-my-cursor/src/custom.tsx 4/5 Well-implemented custom configuration form with proper validation
extensions/where-is-my-cursor/src/off.tsx 4/5 Clean implementation for turning off cursor highlight
extensions/where-is-my-cursor/src/presentation-mode.tsx 4/5 Presentation mode command with appropriate error handling
extensions/where-is-my-cursor/package.json 4/5 Proper command structure expansion with good organization
extensions/where-is-my-cursor/assets/LocateCursor.swift 4/5 Comprehensive Swift rewrite with robust configuration system
extensions/where-is-my-cursor/README.md 4/5 Significantly improved documentation with minor formatting issues

Confidence score: 1/5

  • This PR is not ready to merge and will cause immediate failures due to critical issues
  • Score reflects the completely empty main.tsx file which breaks the extension entirely, plus missing changelog formatting requirements
  • Pay immediate attention to src/main.tsx (completely empty) and CHANGELOG.md (missing {PR_MERGE_DATE} template)

Context used:

Rule - There is no UserInitiated for showToast (link)

11 files reviewed, 6 comments

Edit Code Review Bot Settings | Greptile

luciodaou and others added 5 commits August 23, 2025 19:51
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@luciodaou luciodaou marked this pull request as draft August 24, 2025 00:08
@luciodaou luciodaou marked this pull request as ready for review August 24, 2025 00:16
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

Note: This review covers only the changes made since the last review (commit 881d48a), not the entire PR.

The most recent changes address several critical issues identified in the previous review. The main updates include:

  1. Input validation improvements: The custom.tsx file now includes comprehensive validation for all numeric form fields (duration, screen opacity, circle radius, circle opacity, border width) with proper range checks and error messages to prevent invalid inputs that could crash the application.

  2. Grammar correction: The README.md file was updated to fix the grammatical error, changing "where's the cursors at" to "where the cursor is" for better professional presentation.

  3. Changelog compliance: The CHANGELOG.md entry title was corrected to include the required {PR_MERGE_DATE} template string, ensuring compliance with repository formatting standards.

However, several critical issues remain unresolved from the previous review:

Important Files Changed

Changed Files
Filename Score Overview
extensions/where-is-my-cursor/src/custom.tsx 2/5 Added comprehensive input validation for numeric fields but contains incomplete JSON escaping regex and potential force unwrapping issues
extensions/where-is-my-cursor/README.md 5/5 Fixed grammar error from "where's the cursors at" to "where the cursor is"
extensions/where-is-my-cursor/CHANGELOG.md 5/5 Added required {PR_MERGE_DATE} template string to changelog entry title
extensions/where-is-my-cursor/assets/LocateCursor.swift 1/5 Contains critical duplicate event monitor creation that will cause memory leaks and unpredictable behavior
extensions/where-is-my-cursor/package.json 2/5 Changed main command name which could break existing user configurations
extensions/where-is-my-cursor/src/main.tsx 3/5 Simple implementation but lacks proper error handling and async management

Confidence score: 1/5

  • This PR contains critical issues that will cause memory leaks and potential crashes in production
  • Score reflects unresolved duplicate event monitors in Swift code and incomplete JSON escaping logic that could cause runtime failures
  • Pay close attention to extensions/where-is-my-cursor/assets/LocateCursor.swift (duplicate event monitors on lines 326-337) and the regex pattern on line 89 of custom.tsx

6 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

@luciodaou luciodaou marked this pull request as ready for review August 26, 2025 00:59
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

NOTE: This review covers only the changes made since the last review (commit 4e3a8f0), not the entire PR.

The most recent changes primarily address critical code issues in the Swift implementation. The key improvements include fixing duplicate keyDownMonitor assignments in LocateCursor.swift where the first assignment was being overwritten by the second, and replacing force unwrapping with proper error handling using fatalError for better crash reporting when the Application Support directory is unavailable. The Swift code also received improved error handling and cleanup logic.

Additionally, minor refinements were made to the TypeScript files, including better error handling patterns and code organization. The main functionality remains intact with the five-command structure (default mode, off, simple-mode, presentation-mode, and custom configuration), while the underlying Swift binary has been made more robust and reliable.

These changes build upon the complete overhaul of the extension that transformed it from a single-command utility into a comprehensive cursor location toolkit with multiple display modes and JSON-based configuration.

Important Files Changed

Files Changed
Filename Score Overview
extensions/where-is-my-cursor/assets/LocateCursor.swift 3/5 Fixed duplicate keyDownMonitor assignments and improved error handling, but still has critical issues with force unwrapping
extensions/where-is-my-cursor/src/main.tsx 4/5 Switched from exec to execFile for security and removed async keyword for better callback handling
extensions/where-is-my-cursor/src/custom.tsx 4/5 Minor improvements to form validation and error handling in the custom configuration interface
extensions/where-is-my-cursor/src/off.tsx 5/5 Clean implementation for turning off cursor highlight with proper error handling
extensions/where-is-my-cursor/src/simple-mode.tsx 4/5 Simple mode execution with appropriate error handling
extensions/where-is-my-cursor/src/presentation-mode.tsx 4/5 Presentation mode execution with proper error feedback

Confidence score: 3/5

  • This PR has made progress on critical issues but still contains potential crash conditions in the Swift code
  • Score reflects improvements in duplicate code elimination and security enhancements, but concerns remain about force unwrapping in critical paths
  • Pay close attention to extensions/where-is-my-cursor/assets/LocateCursor.swift for the remaining force unwrapping issues that could cause crashes

12 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@pernielsentikaer
Copy link
Collaborator

Is this ready for another review @luciodaou

@luciodaou luciodaou marked this pull request as draft August 27, 2025 04:00
…n compilation, while keeping previous features.
@luciodaou
Copy link
Contributor Author

@pernielsentikaer I just included the commit. It is being built without problems locally. The build error GitHub is showing happened to me when Package.swift was set with // swift-tools-version:5.4. When I changed to // swift-tools-version:5.9, the error was solved.

@pernielsentikaer
Copy link
Collaborator

It should work, you just have to fix the issue mentioned in the CI

/Users/runner/work/extensions/extensions/extensions/where-is-my-cursor/swift/locatecursor/Package.swift:23:1: error: unexpected ',' separator

@luciodaou luciodaou marked this pull request as ready for review August 28, 2025 16:52
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This review covers only the changes made since the last review (commit 75d5ebf), not the entire PR.

The latest changes in this PR include several critical updates to the cursor location extension. A new .ts file has been added that implements the main 'Where Is My Cursor?' command using the Swift integration pattern established in the rest of the extension. A critical JSON syntax error has been introduced in package.json that will prevent the extension from loading properly. Additionally, there's been a file extension change from .tsx to .ts for the presentation mode file, maintaining the same Swift integration functionality but with proper TypeScript conventions.

These changes continue the architectural shift from Node.js execFile calls to direct Swift function integration using Raycast's Swift macro system. The new main command file follows the established pattern of calling the locatecursor Swift function with empty parameters for default behavior, includes proper error handling with toast notifications, and closes the main window after execution for good UX.

Important Files Changed

Files Changed
Filename Score Overview
extensions/where-is-my-cursor/package.json 1/5 JSON syntax error with malformed closing bracket structure that prevents extension loading
extensions/where-is-my-cursor/src/where-is-my-cursor.ts 4/5 New main command implementation using Swift integration with proper error handling
extensions/where-is-my-cursor/src/presentation-mode.ts 4/5 File extension change from .tsx to .ts with identical Swift integration functionality

Confidence score: 1/5

  • This PR has a critical JSON syntax error that will prevent the extension from loading at all
  • Score reflects the blocking nature of the malformed package.json file structure
  • Pay immediate attention to extensions/where-is-my-cursor/package.json which has invalid JSON syntax on lines 46-47

10 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@luciodaou
Copy link
Contributor Author

Finally ok! These JSON commas drive me nuts.

@luciodaou
Copy link
Contributor Author

@pernielsentikaer the GitHub checks timed out somehow. Can you retrigger them or even ask for Greptile review?

@pernielsentikaer
Copy link
Collaborator

@greptileai can you do a fresh review?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR is a complete overhaul of the "Where Is My Cursor?" extension, replacing the simple Swift-based binary with a more comprehensive Swift application that offers multiple operating modes and enhanced customization options. The update transforms this from a basic cursor locator into a feature-rich tool with preset modes and custom configuration capabilities.

Key Changes:

  • Complete rewrite of the underlying Swift application with configurable presets and custom modes
  • Addition of multiple commands: Simple Mode, Presentation Mode, Custom Mode, and Turn Off functionality
  • Enhanced UI with a custom form for user configuration of cursor highlighting parameters

Reviewed Changes

Copilot reviewed 14 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
swift/locatecursor/Sources/locatecursor.swift New comprehensive Swift application with configuration loading, UI classes, and multi-mode support
swift/locatecursor/Package.swift Swift package configuration for the new locatecursor executable
swift/locatecursor/Package.resolved Package dependency resolution file
swift/locatecursor/Info.plist macOS application bundle configuration
src/where-is-my-cursor.ts Updated main command to use new Swift import and error handling
src/simple-mode.ts New command for simple cursor highlighting mode
src/presentation-mode.ts New command for presentation-friendly cursor highlighting
src/off.ts New command to manually disable cursor highlighting
src/custom.tsx New React form component for custom cursor highlighting configuration
package.json Updated commands configuration with new subtitle fields and additional commands
assets/locatecursor.json Configuration file with preset definitions for different highlighting modes
assets/LocateCursor.swift Removed old standalone Swift source file
README.md Completely rewritten documentation with feature descriptions and examples
CHANGELOG.md Added new entry describing the major update
Files not reviewed (1)
  • extensions/where-is-my-cursor/package-lock.json: Language not supported

@@ -1,3 +1,15 @@
# Where's Cursor Changelog
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

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

Headers in CHANGELOG.md and README.md should have the same wording as title in package.json. The package.json title is "Where Is My Cursor?" but the changelog header says "Where's Cursor".

Copilot generated this review using guidance from repository custom instructions.
return;
}

// Fix JSON escaping: escape both quotes and backslashes
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

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

This comment appears to be incorrect or misplaced. The code below it validates circle opacity, not JSON escaping. Please update or remove this misleading comment.

Suggested change
// Fix JSON escaping: escape both quotes and backslashes

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

I'll do a fresh review of this "Where Is My Cursor?" extension overhaul. This is a significant rewrite that transforms a simple cursor locator into a comprehensive tool with multiple modes and Swift-based implementation.

Overall Assessment

This is an excellent overhaul that transforms the extension from a basic utility into a professional, feature-rich tool. The migration from a simple executable to a Swift-based implementation with multiple modes is well-executed.

Strengths

1. Architecture Improvements

  • Swift Integration: Proper use of Raycast's Swift tooling instead of bundled executables
  • Configuration-driven: JSON-based preset system is elegant and maintainable
  • Multi-mode Support: Default, Simple, Presentation, and Custom modes cover various use cases

2. Code Quality

  • TypeScript Implementation: Clean, well-structured TypeScript code with proper error handling
  • Swift Code: Well-organized Swift implementation with proper separation of concerns
  • Configuration Management: Robust config loading with sensible defaults

3. User Experience

  • Multiple Entry Points: Different commands for different use cases
  • Custom Mode: Flexible form-based configuration
  • Visual Feedback: Appropriate toasts and UI feedback
  • Keyboard Controls: ESC key to dismiss is intuitive

Technical Review

TypeScript Files

The TypeScript implementation is solid:

  • Proper error handling with showFailureToast
  • Clean separation between UI and business logic
  • Form validation in custom mode is comprehensive

Swift Implementation

The Swift code demonstrates good practices:

  • Proper memory management and cleanup
  • Multi-monitor support with correct coordinate calculations
  • Process management with lock files to prevent conflicts
  • Clean separation between data structures and UI components

Configuration System

The JSON-based configuration is well-designed:

  • Clear structure with sensible defaults
  • Flexible color system (named colors + hex)
  • Proper validation and fallbacks

Minor Suggestions

1. Error Handling Enhancement

// In custom.tsx, consider adding more specific validation messages
if (values.circleColorHex && !/^#[0-9A-Fa-f]{6}$/.test(values.circleColorHex)) {
  showFailureToast("Hex color must be in format #RRGGBB");
  return;
}

2. Swift Code Improvement

The Swift implementation could benefit from a small optimization in the color parsing:

// Consider caching parsed colors to avoid repeated parsing
private static var colorCache: [String: NSColor] = [:]

3. Documentation

The README is excellent, but consider adding:

  • Troubleshooting section for common issues
  • System requirements (macOS version)
  • Performance impact notes

Package.json Analysis

The manifest changes are appropriate:

  • Good command structure with clear titles and subtitles
  • Proper separation of no-view and view commands
  • Dependencies are correctly updated

Security Considerations

✅ No security concerns:

  • Swift implementation uses standard system APIs
  • No external network requests
  • Proper sandboxing with application support directory

Performance Notes

The implementation appears efficient:

  • Event monitoring is properly managed
  • Lock file system prevents resource conflicts
  • Memory cleanup is handled correctly

Final Verdict

This is a high-quality overhaul that significantly improves the extension. The code is well-structured, the user experience is thoughtfully designed, and the technical implementation is solid. The migration to Swift with proper Raycast integration is executed professionally.

Recommendation: Approve with confidence. This represents a substantial improvement over the original implementation.

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Thanks for making this huge update 🔥

@raycastbot raycastbot merged commit c42c246 into raycast:main Sep 1, 2025
2 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

Published to the Raycast Store:
https://raycast.com/luciodaou/where-is-my-cursor

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

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

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: where-is-my-cursor Issues related to the where-is-my-cursor extension OP is author The OP of the PR is the author of the extension status: awaiting response from dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants