Python bindings for the Hyprland compositor.
Project description
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 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 :sunglasses:
Quickstart
Installation
pip install 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 workspace_changed(sender, **kwargs):
current_workspace_id = kwargs.get('active_workspace_id')
if current_workspace_id == 6:
run_or_fail(["notify-send", "We are on workspace 6."])
instance.signal_active_workspace_changed.connect(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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hyprpy-0.1.8.tar.gz
.
File metadata
- Download URL: hyprpy-0.1.8.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d791469dcd3d710c8959e8ce2d5ffe4d370940a317e112cf7be7b1a8f16f31cf |
|
MD5 | c0847adc3aaa74a6b0d76e5f7ff698af |
|
BLAKE2b-256 | dd1b6cff0c04cc2c68ac722c8f91763896268ba45adc9dc984c3f41f7417afae |
File details
Details for the file hyprpy-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: hyprpy-0.1.8-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a36c00489a6da4e651935c029029f174c9b9b6ec18db475acdec291d68ac16be |
|
MD5 | 388e96c02d71bf48357270d6c8a01efe |
|
BLAKE2b-256 | 97e02be866f8a46650699cf905718e938c2de0363b05526961fdce7d5c83b355 |