Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/cursor-info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sha2 = "0.10"
[target.'cfg(target_os = "macos")'.dev-dependencies]
objc2 = "0.6"
objc2-app-kit = { version = "0.3.0", features = ["NSCursor", "NSApplication"] }
os_info = "3.13.0"
Comment on lines 23 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

os_info should be a regular dependency, not a dev-dependency.

The os_info crate is used by is_tahoe() which is called from get_cursor_cache() in production code (e.g., studio_recording.rs). Dev-dependencies are only available for tests, examples, and benchmarks—not for library code. This will cause compilation failures on macOS builds.

Apply this diff to fix the dependency section:

-[target.'cfg(target_os = "macos")'.dev-dependencies]
-objc2 = "0.6"
-objc2-app-kit = { version = "0.3.0", features = ["NSCursor", "NSApplication"] }
-os_info = "3.13.0"
+[target.'cfg(target_os = "macos")'.dependencies]
+objc2 = "0.6"
+objc2-app-kit = { version = "0.3.0", features = ["NSCursor", "NSApplication"] }
+os_info = "3.13.0"

Alternatively, if objc2 and objc2-app-kit should remain dev-dependencies (for the CLI example), move only os_info to a separate [target.'cfg(target_os = "macos")'.dependencies] section.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[target.'cfg(target_os = "macos")'.dev-dependencies]
objc2 = "0.6"
objc2-app-kit = { version = "0.3.0", features = ["NSCursor", "NSApplication"] }
os_info = "3.13.0"
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6"
objc2-app-kit = { version = "0.3.0", features = ["NSCursor", "NSApplication"] }
os_info = "3.13.0"
🤖 Prompt for AI Agents
In crates/cursor-info/Cargo.toml around lines 23 to 26, os_info is mistakenly
listed under target macOS dev-dependencies but is used by production code; move
os_info out of dev-dependencies into the target macOS regular dependencies
section (i.e., create or use [target.'cfg(target_os = "macos")'.dependencies]
and add os_info = "3.13.0") so it is available to library code at build time; if
objc2 and objc2-app-kit must remain dev-dependencies for examples/CLI, keep them
under dev-dependencies and only relocate os_info to the regular dependencies
block.



[lints]
Expand Down
42 changes: 4 additions & 38 deletions crates/cursor-info/examples/cli.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::collections::HashMap;

use cap_cursor_info::{CursorShape, CursorShapeMacOS};
use sha2::{Digest, Sha256};
use cap_cursor_info::CursorShape;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Missing import: CursorShapeMacOS is used but not imported.

Line 21 and 38 reference CursorShapeMacOS, but only CursorShape is imported. This will cause a compilation error.

-use cap_cursor_info::CursorShape;
+use cap_cursor_info::{CursorShape, CursorShapeMacOS};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
use cap_cursor_info::CursorShape;
use cap_cursor_info::{CursorShape, CursorShapeMacOS};
🤖 Prompt for AI Agents
In crates/cursor-info/examples/cli.rs around lines 1 to 38, the code uses
CursorShapeMacOS at lines 21 and 38 but only imports CursorShape, causing a
compile error; update the use statement to also import CursorShapeMacOS (for
example add CursorShapeMacOS to the cap_cursor_info import) so both types are in
scope, and re-run cargo check to verify the fix.


#[allow(unreachable_code)]
fn main() {
Expand All @@ -15,45 +12,14 @@ fn main() {
fn run() {
use objc2::{MainThreadMarker, rc::Retained};
use objc2_app_kit::{NSApplication, NSCursor};
use sha2::{Digest, Sha256};

let mtm = MainThreadMarker::new().expect("Not on main thread");
let _app: Retained<NSApplication> = NSApplication::sharedApplication(mtm);

let cursors = vec![
("arrow", NSCursor::arrowCursor()),
("contextualMenu", NSCursor::contextualMenuCursor()),
("closedHand", NSCursor::closedHandCursor()),
("crosshair", NSCursor::crosshairCursor()),
("disappearingItem", NSCursor::disappearingItemCursor()),
("dragCopy", NSCursor::dragCopyCursor()),
("dragLink", NSCursor::dragLinkCursor()),
("IBeam", NSCursor::IBeamCursor()),
("openHand", NSCursor::openHandCursor()),
("operationNotAllowed", NSCursor::operationNotAllowedCursor()),
("pointingHand", NSCursor::pointingHandCursor()),
("resizeDown", NSCursor::resizeDownCursor()),
("resizeLeft", NSCursor::resizeLeftCursor()),
("resizeLeftRight", NSCursor::resizeLeftRightCursor()),
("resizeRight", NSCursor::resizeRightCursor()),
("resizeUp", NSCursor::resizeUpCursor()),
("resizeUpDown", NSCursor::resizeUpDownCursor()),
("IBeamVertical", NSCursor::IBeamCursorForVerticalLayout()),
];

unsafe {
let mut cursor_lookup = HashMap::new();

for (name, cursor) in cursors {
let hash = hex::encode(Sha256::digest(
cursor
.image()
.TIFFRepresentation()
.expect("Failed to get TIFF representation of built-in cursor")
.as_bytes_unchecked(),
));
println!("{name}: {hash}");
cursor_lookup.insert(hash, name);
}
let cursor_hash_map = CursorShapeMacOS::get_cursor_cache();
println!("Cursors hash map: {:#?}", cursor_hash_map);

println!("\nStarting cursor monitoring...\n");

Expand Down
Loading