Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Implements instant screenshot capture during drawing mode to enable quick annotations, tutorials, and bug reports.

Changes

Core functionality:

  • Ctrl+S: Captures full screen with overlay drawing → Pictures\GhostDraw\GhostDraw_YYYYMMDD_HHMMSS.png
  • S: Opens Windows Snipping Tool, temporarily hiding overlay for clean custom area capture

Architecture:

  • ScreenshotService: Handles screen capture via GDI, clipboard operations, and snipping tool integration
  • GlobalKeyboardHook: Tracks Control key state internally (volatile field) to avoid GetAsyncKeyState race conditions
  • DrawingManager: Orchestrates capture operations with 500ms overlay restoration delay
  • AppSettings: Added 4 persisted properties (save path, clipboard copy, shutter sound, open folder)

UI/UX:

  • Screenshot saved toast notification (cyberpunk-styled, top-center, 1.5s display)
  • Settings panel with browse button for save location and 3 toggle options
  • Help popup (F1) updated with new shortcuts

Example usage:

// Hook detects Ctrl+S
if (vkCode == VK_S && isKeyDown && _isControlPressed)
{
    ScreenshotFullPressed?.Invoke(this, EventArgs.Empty);
}

// Service captures and saves
var bitmap = new Bitmap(bounds.Width, bounds.Height);
graphics.CopyFromScreen(bounds.Location, Point.Empty, bounds.Size);
bitmap.Save(filePath, ImageFormat.Png);

Safety measures:

  • Pixel format detection for clipboard (prevents color corruption)
  • Volatile Control key state for thread safety
  • Exception handling with logging throughout capture pipeline
  • Proper overlay hide/show with fallback recovery

Testing:

  • 19 unit tests covering event subscription, settings serialization, and service initialization
  • CodeQL scan: 0 vulnerabilities
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Add hotkey to capture screenshot of current drawing (e.g. 'C' key)</issue_title>
<issue_description>## Summary
While the overlay is active, allow the user to instantly capture the current drawing as a PNG screenshot with a single key press (e.g. s). This is essential for quick annotations, tutorials, bug reports, or sharing. Support 2 capture mode. Full screen capture (ctrl + s) or open the windows snip tool to allow dragging and dropping an area (s).

Proposed Behavior

  • Default capture hotkey: s or ctrl+s (while overlay is active and drawing mode enabled)
  • On press → the entire visible drawing canvas and desktop is saved as a PNG/JPEG
  • Default save location:
    %USERPROFILE%\Pictures\GhostDraw\
    (folder is created automatically if it doesn’t exist)
  • File naming example: GhostDraw_YYYYMMDD_HHMMSS.png

Additional Requested Options (settings panel)

  • Change save folder with a Browse… button
  • Include 'Open to folder' option.
  • Optional toggle: “Copy to clipboard after capture” (enabled by default)
  • Optional toggle: “Play shutter sound on capture”

Nice-to-Have Polish

  • Brief visual feedback (e.g. screen flash or small “Saved!” toast in corner)
  • Success/failure notification if save folder is inaccessible

This feature turns the app from a fun toy into a genuinely useful everyday annotation tool.

Notes

  • The s key snip tool functionality may require considering how the overlay works. For example, the overlay lays on top of everything so the snip tool may not be operable. This needs to be considered an a viable solution developed. Ensure new code does not degrade any existing functionality.
  • Ensure project builds with no new errors or warning.
  • Write unit tests and ensure all tests pass. Mock functionality rather then using disk.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 6 commits December 2, 2025 21:34
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
… track Control key state

Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
…dd volatile for thread safety

Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Copilot AI changed the title [WIP] Add hotkey to capture screenshot of current drawing Add screenshot capture hotkeys (Ctrl+S full screen, S snipping tool) Dec 2, 2025
Copilot AI requested a review from RuntimeRascal December 2, 2025 21:54
@RuntimeRascal RuntimeRascal marked this pull request as ready for review December 2, 2025 23:54
@RuntimeRascal RuntimeRascal merged commit 99c8c30 into main Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add hotkey to capture screenshot of current drawing (e.g. 'C' key)

2 participants