OpenAdapt icon indicating copy to clipboard operation
OpenAdapt copied to clipboard

feat: Enhance take_screenshot for multi-monitor support

Open onyedikachi-david opened this issue 8 months ago • 13 comments

Fixes #766 /claim #766

What kind of change does this PR introduce?

Feature

Summary

This PR introduces support for multi-monitor setups in the take_screenshot function. It includes the following changes:

  • Implemented get_current_monitor to determine the monitor where the cursor is currently located.
  • Modified take_screenshot to use get_current_monitor for capturing the correct monitor.
  • Added comprehensive tests for take_screenshot with multiple monitors.
  • Mocked get_current_monitor and mss.mss in tests to simulate multiple monitor configurations.
  • Ensured take_screenshot correctly handles multiple monitors and returns the expected screenshot.

Checklist

  • [x] My code follows the style guidelines of OpenAdapt
  • [x] I have performed a self-review of my code
  • [x] If applicable, I have added tests to prove my fix is functional/effective
  • [x] I have linted my code locally prior to submission
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation (e.g. README.md, requirements.txt)
  • [x] New and existing unit tests pass locally with my changes

How can your code be run and tested?

To run and test the code:

  1. Ensure you have the necessary dependencies installed.
  2. Run the test suite using pytest:
pytest tests/openadapt/test_monitors.py
  1. Verify that all tests pass, including the new tests for multi-monitor support.

Other information

No additional context needed.

onyedikachi-david avatar Jun 22 '24 06:06 onyedikachi-david