Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue on MacOS Darwin where the screeninfo.get_monitors() never terminates #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions remarkable_mouse/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
import sys
from screeninfo import get_monitors, Monitor
from screeninfo import get_monitors, Monitor, Enumerator

from .codes import codes, types

Expand All @@ -28,7 +28,12 @@ def get_monitor(region, monitor_num, orientation):

# compute size of box encompassing all screens
max_x, max_y = 0, 0
for m in get_monitors():
if(sys.platform == 'darwin'):
log.debug(f"Handling MacOS monitors")
monitors = get_monitors(Enumerator.OSX)
else:
monitors = get_monitors()
for m in monitors:
x = m.x + m.width
y = m.y + m.height
max_x = max(x, max_x)
Expand All @@ -41,7 +46,7 @@ def get_monitor(region, monitor_num, orientation):
name="Fake monitor from region selection"
)
else:
monitor = get_monitors()[monitor_num]
monitor = monitors[monitor_num]

log.debug(f"Chose monitor: {monitor}")
log.debug(f"Screen size: ({max_x}, {max_y})")
Expand Down