rr- / screeninfo

Fetch location and size of physical screens.
Other
208 stars 36 forks source link

Added get_primary to screeninfo and exposed it from __init__.py #57

Closed sobeaa closed 3 years ago

sobeaa commented 3 years ago

This would be an useful function for the primary usage of this package: to get the width and height of the primary monitor.

sobeaa commented 3 years ago

Pretty sure those tests will pass in workflow :)

sobeaa commented 3 years ago

This last commit can be dismissed as it's purely visual. It depends on the maintainers' desires really.

sobeaa commented 3 years ago

This commit was so I don't wake up tonight in a cold sweat.

sobeaa commented 3 years ago

I just realized this can be cached in memory to avoid that issue... That would be a better solution.

sobeaa commented 3 years ago

I just realized this can be cached in memory to avoid that issue... That would be a better solution.

Nevermind, I think this current implementation is better because it also covers new monitors, I presume.

sobeaa commented 3 years ago

I slightly tweaked the README format to better accommodate the addition of a new function, I also corrected python console to pycon.

rr- commented 3 years ago

Thanks. This utility function seems so specific that I don't think it makes sense to ship it with the library.

For your learning experience:

-primary = list(map(lambda m: (m.width, m.height), filter(lambda m: m.is_primary, get_monitors())))
+primary = [(m.width, m.height) for m in get_monitors() if m.is_primary]
-tuple(0, 0)
+(0, 0)

Changes to the README formatting are minuscule and irrelevant to your PR.