Skip to main content

hyprland-monitors

Monitor management utilities for Hyprland. Built on top of hyprland-socket.

Scale computation, layout geometry, config line parsing, and hardware capability detection for Hyprland monitor management.

Installation

pip install hyprland-monitors

Usage

Scale computation

Hyprland quantizes display scale to multiples of 1/120 and requires both dimensions to divide evenly. compute_valid_scales finds all valid scales for a given resolution.

from hyprland_monitors.monitors import compute_valid_scales, nearest_scale_index

scales = compute_valid_scales(3440, 1440)
for s in scales:
    print(f"  {s.label} ({s.value})")

# Find the closest valid scale to a target
idx = nearest_scale_index(scales, 1.5)
print(f"Nearest to 1.5: {scales[idx].label}")

Layout geometry

Check adjacency, detect gaps, and adjust positions when monitors resize.

from hyprland_monitors.monitors import (
    MonitorState, is_adjacent, all_monitors_connected, adjust_neighbors,
)

a = MonitorState(name="DP-1", make="", model="", width=1920, height=1080,
                 refresh_rate=60.0, x=0, y=0, scale=1.0)
b = MonitorState(name="DP-2", make="", model="", width=1920, height=1080,
                 refresh_rate=60.0, x=1920, y=0, scale=1.0)

print(is_adjacent(a, b))                # True — edge-adjacent
print(all_monitors_connected([a, b]))   # True — connected group

# After resizing a, shift b to maintain adjacency
old_w, old_h = a.effective_size
a.scale = 2.0
adjust_neighbors([a, b], a, old_w, old_h)
print(b.x)  # 960 — shifted to stay adjacent

Config line parsing

Parse and generate Hyprland monitor = config lines.

from hyprland_monitors.monitors import lines_from_monitors, parse_mode, parse_extras

lines = lines_from_monitors([a, b])
# ['DP-1, 1920x1080@60.00Hz, 0x0, 2', 'DP-2, 1920x1080@60.00Hz, 960x0, 1']

mode = parse_mode("3440x1440@165.00Hz")
# {'width': 3440, 'height': 1440, 'refresh_rate': 165.0}

extras = parse_extras("DP-1, 1920x1080@60, 0x0, 1, bitdepth, 10, vrr, 1")
# {'bit_depth': '10', 'vrr': '1'}

Hardware detection

Query monitor capabilities via EDID parsing and DRM kernel properties.

from hyprland_monitors.hardware import get_monitor_capabilities

caps = get_monitor_capabilities("DP-1")
# {'hdr': True, 'ten_bit': True, 'vrr': False,
#  'max_luminance': 603.65, 'max_avg_luminance': 400.0, 'min_luminance': 0.03}

License

MIT

Metadata

Release files for hyprland-monitors 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hyprland-monitors 0.9.2
File Size Uploaded Provenance Actions
hyprland_monitors-0.9.2.tar.gz 13.9 kB With provenance Details for hyprland_monitors-0.9.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hyprland-monitors 0.9.2
File Interpreter ABI Platform Actions
hyprland_monitors-0.9.2-py3-none-any.whl Python 3 none any Details for hyprland_monitors-0.9.2-py3-none-any.whl

Total release size: 29.4 kB

Release files / hyprland_monitors-0.9.2.tar.gz

Download URL hyprland_monitors-0.9.2.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
13637c9a33df4f1dfe76b41695b7fbd8c246a7e83de816fb2435a6d26eb4ea55
BLAKE2b-256 checksum
How to use checksums
cf6697841d45d7052ad1b60ce04af714211083ff969659533703393430ad53e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / hyprland_monitors-0.9.2-py3-none-any.whl

Download URL hyprland_monitors-0.9.2-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8109d965ffb4cd08ea8f3614d8f8fde24a17aebe776aff1ee8d8bd10bb0d5c38
BLAKE2b-256 checksum
How to use checksums
34ac67df9ede0de667d26de7bd97c581f30eadd84e961cf98e5a35c23476ade8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for hyprland-monitors 0.9.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hyprland_monitors-0.9.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page