Open
Conversation
- Add OSX and LINUX compilation symbols to cycod.csproj - Implement native macOS screenshot capture using Core Graphics framework - Add P/Invoke declarations for CGDisplay, CoreFoundation, and ImageIO APIs - Update platform support checks to include macOS alongside Windows - Update error messages and descriptions to reflect macOS support - Maintain proper memory management with CFRelease for Core Foundation objects The implementation uses native macOS APIs without external dependencies: - CGDisplayCreateImage for screen capture - CGImageDestination for PNG export - CFURL and CFString for file path handling Tested: Build succeeds with no errors or warnings
Features: - ListWindows() - Enumerate all visible application windows with metadata (JSON) - TakeScreenshotOfApp(appName) - Capture screenshots by application name - TakeScreenshotOfWindowWithTitle(title) - Capture screenshots by window title - TakeScreenshotOfDisplay(displayNumber) - Capture specific displays - TakeScreenshotOfWindow(windowId) - Advanced: capture by window ID Implementation: - Uses hybrid approach: Core Graphics for window enumeration + screencapture CLI for capture - No Screen Recording permissions required when run from terminal - Case-insensitive, partial matching for app names and titles - Returns helpful error messages when multiple windows match - Properly guarded with #if OSX for macOS-only code Files: - Added: src/cycod/Helpers/WindowInfo.cs - Window metadata class - Modified: src/cycod/Helpers/ScreenshotHelper.cs - Core screenshot and enumeration logic - Modified: src/cycod/FunctionCallingTools/ScreenshotHelperFunctions.cs - AI tool wrappers - Added: docs/macos-window-screenshot-feature.md - Feature documentation Fixes: - Fixed macOS screenshot permissions issue by using screencapture CLI instead of Core Graphics capture - Fixed CGWindowListCopyWindowInfo import (CoreGraphics framework, not CoreFoundation) - Fixed dictionary key names (use 'k' prefix: kCGWindowOwnerName)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends cycod's screenshot functionality to support macOS in addition to Windows. On Windows, it captures the default screen; on macOS, it can capture specific windows identified by name or process ID, as well as entire displays.
Key Changes:
- Added macOS screenshot support using native
screencaptureutility and Core Graphics APIs - Implemented window enumeration and targeted screenshot capture for macOS
- Updated platform checks throughout to include OSX alongside Windows
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cycod/cycod.csproj | Added OSX and LINUX build constants for conditional compilation |
| src/cycod/SlashCommands/SlashScreenshotCommandHandler.cs | Updated platform check to support both Windows and macOS |
| src/cycod/Helpers/WindowInfo.cs | New data class representing macOS window metadata |
| src/cycod/Helpers/ScreenshotHelper.cs | Core screenshot functionality with macOS window enumeration and capture methods |
| src/cycod/FunctionCallingTools/ScreenshotHelperFunctions.cs | AI-callable wrapper functions for screenshot operations |
| docs/macos-window-screenshot-feature.md | Documentation of the new macOS screenshot capabilities |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds the ability for cycod to take screenshots, both on Window and on MacOS.
On Windows it will take a screenshot of the default screen.
On MacOS it can take a screenshot of any window that can be identified by name or process id.