Hyprpy
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
- include dispatchers in components API
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)
| File | Size | Uploaded | |
|---|---|---|---|
| hyprpy-0.2.1.tar.gz | 25.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|