Skip to main content

Hyprpy

Python GitHub Release PyPI - Version AUR Version

Hyprpy is a library that provides python bindings for the Hyprland wayland compositor.

With Hyprpy you can very easily retrieve information about windows, workspaces and monitors in a running Hyprland instance. It also offers an event monitor, allowing you to write your own python callback functions which execute in response to Hyprland events.

Hyprpy uses unix sockets to communicate with Hyprland, making it fast and efficient.

Please check out the documentation! Hyprpy is fully typed and extensively documented. Happy hacking 😎

Quickstart

Installation

Pip

Install Hyprpy with pip by running:

pip install hyprpy

Arch Linux

Hyprpy is available in the AUR as python-hyprpy.

If you are using an AUR helper like paru simply install it by running:

paru -S python-hyprpy

Usage examples

from hyprpy import Hyprland

instance = Hyprland()


# Fetch active window and display information:
window = instance.get_active_window()
print(window.wm_class)
print(window.width)
print(window.position_x)


# Print information about the windows on the active workspace
workspace = instance.get_active_workspace()
for window in workspace.windows:
    print(f"{window.address}: {window.title} [{window.wm_class}]")


# Get the resolution of the first monitor
monitor = instance.get_monitor_by_id(0)
if monitor:
    print(f"{monitor.width} x {monitor.height}")


# Get all windows currently on the special workspace
special_workspace = instance.get_workspace_by_name("special")
if special_workspace:
    special_windows = special_workspace.windows
    for window in special_windows:
        print(window.title)


# Show a desktop notification every time we switch to workspace 6
from hyprpy.utils.shell import run_or_fail

def on_workspace_changed(sender, **kwargs):
    workspace_id = kwargs.get('workspace_id')
    if workspace_id == 6:
        run_or_fail(["notify-send", "We are on workspace 6."])

instance.signals.workspacev2.connect(on_workspace_changed)
instance.watch()

Development

Hyprpy is in active development! Please file an issue if you find any bugs or have a feature request.

Your contributions are greatly appreciated.

Roadmap

Release files for hyprpy 0.2.1

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

Source distribution (sdist)

Source distribution for hyprpy 0.2.1
File Size Uploaded
hyprpy-0.2.1.tar.gz 25.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hyprpy 0.2.1
File Interpreter ABI Platform
hyprpy-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 54.1 kB

Release files / hyprpy-0.2.1.tar.gz

Download URL hyprpy-0.2.1.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
88615d869d0dcc56d29ffad685a652ffd935348c3d3bd8a97e68f4a913eb3bf0
BLAKE2b-256 checksum
How to use checksums
36c9ae481dea6ca032287fdb87c3afab1b9163e4840df5667d2d238c30d862f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.11

Release files / hyprpy-0.2.1-py3-none-any.whl

Download URL hyprpy-0.2.1-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22d2ae5cf29d88eafafe2de2758a222694a7822fa470a2cfaa845df8162026f6
BLAKE2b-256 checksum
How to use checksums
347fe462ee891e9fcd6d37defed3bc5e5d5b5724032a2044e877226e27be0da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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