{"id":2277,"library":"screeninfo","title":"Screeninfo","description":"Screeninfo is a Python library designed to fetch the location and size of physical screens connected to a system. It supports various operating systems including MS Windows, MS Windows (Cygwin), GNU/Linux (via X11 with Xinerama and experimental DRM), and macOS (using AppKit). The current version is 0.8.1, released in September 2022, and while no explicit release cadence is stated, it remains actively maintained.","status":"active","version":"0.8.1","language":"python","source_language":"en","source_url":"https://github.com/rr-/screeninfo","tags":["monitor","screen","display","resolution","system-info"],"install":[{"cmd":"pip install screeninfo","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"get_monitors","correct":"from screeninfo import get_monitors"},{"symbol":"get_primary_monitor","correct":"from screeninfo import get_primary_monitor"},{"note":"Used to force a specific backend for monitor enumeration.","symbol":"Enumerator","correct":"from screeninfo import get_monitors, Enumerator"},{"note":"While 'Monitor' objects are returned by 'get_monitors', direct import is from screeninfo.common if needed for type hinting or inspection.","symbol":"Monitor","correct":"from screeninfo.common import Monitor"}],"quickstart":{"code":"from screeninfo import get_monitors, get_primary_monitor\n\nprint(\"Detected monitors:\")\nfor m in get_monitors():\n    print(f\"  Monitor(x={m.x}, y={m.y}, width={m.width}, height={m.height}, is_primary={m.is_primary}, name={m.name})\")\n\nprimary = get_primary_monitor()\nif primary:\n    print(f\"\\nPrimary monitor: Monitor(x={primary.x}, y={primary.y}, width={primary.width}, height={primary.height}, name={primary.name})\")\nelse:\n    print(\"\\nNo primary monitor detected.\")","lang":"python","description":"This quickstart code demonstrates how to retrieve information about all connected monitors and specifically the primary monitor using `screeninfo`."},"warnings":[{"fix":"Ensure display drivers are correctly installed and that the environment is compatible with one of the supported backends (X11 for Linux, AppKit for macOS, etc.). Forcing a specific enumerator (e.g., `get_monitors(Enumerator.OSX)`) might sometimes help, but often points to a deeper environmental issue.","message":"Users, especially on macOS or certain Linux desktop environments (like Wayland), may encounter `screeninfo.common.ScreenInfoError: No enumerators available`. This indicates the library could not detect a compatible display backend.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Users on less-tested platforms should be aware of this and be prepared to contribute or work around platform-specific issues. Check GitHub issues for known platform-specific problems.","message":"The maintainer explicitly states that they do not personally test on OSX or other environments, encouraging pull requests for these platforms. This may lead to slower support or platform-specific quirks being less promptly addressed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify that your system's locale settings are correctly configured for UTF-8. If using Poetry for development, be aware that `poetry.dev-dependencies` is deprecated; ensure your `pyproject.toml` uses `poetry.group.dev.dependencies` if you are developing `screeninfo` or a project that uses it with `poetry`.","message":"Some users have reported `UnicodeDecodeError` during installation on certain Linux distributions (e.g., Arch Linux) when using poetry, potentially related to locale settings or poetry's deprecated `dev-dependencies` section.","severity":"gotcha","affected_versions":"0.8.1 and possibly earlier (installation process specific)"}],"env_vars":null,"search_vec":"'0.8.1':48 '2022':52 'activ':63 'appkit':43 'cadenc':58 'connect':17 'current':45 'cygwin':31 'design':7 'display':67 'drm':39 'experiment':38 'explicit':56 'fetch':9 'gnu/linux':32 'includ':26 'info':71 'librari':6 'locat':11 'maco':41 'maintain':64 'monitor':65 'ms':27,29 'oper':24 'physic':15 'python':5 'releas':49,57 'remain':62 'resolut':68 'screen':16,66 'screeninfo':1,2 'septemb':51 'size':13 'state':60 'support':22 'system':20,25,70 'system-info':69 'use':42 'various':23 'version':46 'via':33 'window':28,30 'x11':34 'xinerama':36","created_at":"2026-04-09T18:51:05.613207+00:00","updated_at":"2026-04-16T21:28:41.457799+00:00","problems":[{"fix":"pip install screeninfo","cause":"The 'screeninfo' package is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'screeninfo'"},{"fix":"Ensure the script is run in a graphical environment or that the DISPLAY environment variable is correctly set. For headless servers, Xvfb can sometimes be used to provide a virtual display.","cause":"On Linux, screeninfo requires access to an X server. This error occurs when no X display is found or accessible, such as in a headless environment, SSH without X forwarding, or a misconfigured DISPLAY variable.","error":"Xlib.error.DisplayError: Can't open display:"},{"fix":"pip install pyobjc-core","cause":"On macOS, screeninfo relies on the pyobjc-core package, which might be missing or corrupted, preventing screeninfo from interacting with the macOS display APIs.","error":"ModuleNotFoundError: No module named 'objc._objc'"},{"fix":"Use 'screeninfo.get_monitors()' and iterate through the list to find the primary monitor by checking the 'is_primary' attribute, for example: `primary_monitor = next((m for m in screeninfo.get_monitors() if m.is_primary), None)`","cause":"This error occurs when trying to access 'primary_monitor' directly from the screeninfo module, which was part of an older API. The current version uses 'get_monitors()' and the 'is_primary' attribute on Monitor objects.","error":"AttributeError: module 'screeninfo' has no attribute 'primary_monitor'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.8.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/rr-/screeninfo","docs":null,"changelog":null,"pypi":"https://pypi.org/project/screeninfo/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}