{"id":16538704,"url":"https://github.com/spyoungtech/wmutil","last_synced_at":"2025-08-25T14:10:42.074Z","repository":{"id":247551455,"uuid":"826154041","full_name":"spyoungtech/wmutil","owner":"spyoungtech","description":"Utility functions for getting monitor (display) information on Windows","archived":false,"fork":false,"pushed_at":"2025-01-22T06:32:43.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T00:44:44.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spyoungtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-09T07:18:41.000Z","updated_at":"2025-01-22T06:32:46.000Z","dependencies_parsed_at":"2024-07-09T10:43:08.227Z","dependency_job_id":"3984712f-8157-4639-b22a-a25a410acc43","html_url":"https://github.com/spyoungtech/wmutil","commit_stats":null,"previous_names":["spyoungtech/wmutil"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/spyoungtech/wmutil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fwmutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fwmutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fwmutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fwmutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spyoungtech","download_url":"https://codeload.github.com/spyoungtech/wmutil/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fwmutil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272077690,"owners_count":24869288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T18:46:28.430Z","updated_at":"2025-08-25T14:10:42.045Z","avatar_url":"https://github.com/spyoungtech.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wmutil\n\nUtility functions for getting monitor (display) information on Windows. \n\n\n## Installation\n\nRequires Python 3.8+ and Windows\n\n```commandline\npip install wmutil\n```\n\n## Usage\n\n```python\nimport wmutil\n\n\n# Enumerate all monitors\nprint('Enumerating monitors:')\nfor monitor in wmutil.enumerate_monitors():\n    # Print monitor attributes\n    print(monitor, monitor.name, monitor.size, monitor.position, monitor.refresh_rate_millihertz, monitor.handle, sep='\\n\\t')\n\n\n# Get primary monitor\nprimary_monitor = wmutil.get_primary_monitor()\n\n# Get a monitor based on point coordinates\nmonitor = wmutil.get_monitor_from_point(0, 0)\n\n# compare monitor objects\nif monitor == primary_monitor:\n   print('it is the primary monitor')\n\n\n# Get monitor from an HWND\nfrom ahk import AHK  # pip install ahk[binary]\nahk = AHK()\n\nwindow = ahk.active_window\nhwnd = int(window.id, 0)\nmonitor_for_active_window = wmutil.get_window_monitor(hwnd)\nprint(window.title, 'is using monitor', monitor_for_active_window.name)\n\n```\n\nExample output:\n\n```\nEnumerating monitors:\n\u003cwmutil.Monitor object; handle=491197379\u003e\n        \\\\.\\DISPLAY1\n        (1920, 1080)\n        (-3840, -418)\n        60000\n        491197379\n\u003cwmutil.Monitor object; handle=85595795\u003e\n        \\\\.\\DISPLAY2\n        (3440, 1440)\n        (0, 0)\n        60000\n        85595795\nit is the primary monitor\n\nUntitled - Notepad is using monitor \\\\.\\DISPLAY2\n```\n\n**Changing the primary monitor:**\n\nYou can use the `set_primary_monitor` function, which accepts a display name or you can use the `set_primary` method of a `Monitor` object to change the \nprimary monitor. If the monitor is already the primary monitor, no change will be made and the operation is considered successful. Returns `True` when successful and \n`False` when not successful. If an invalid monitor name is given, an exception is raised.\n\n```python\nimport wmutil\nmonitor: wmutil.Monitor  # assume this is already defined\n\nwmutil.set_primary_monitor(monitor.name)\n# or\nmonitor.set_primary()\n```\n\n\n\nNotes:\n\n- `monitor.size` may not necessarily reflect the monitor's resolution, but rather is the geometry used for drawing or moving windows\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspyoungtech%2Fwmutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspyoungtech%2Fwmutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspyoungtech%2Fwmutil/lists"}