Skip to main content

Hyprland-py

An unofficial async python wrapper for Hyprland's IPC supposed to somewhat work like awesomewm api in lua

Todo

  • async sockets
  • change config options
  • event listeners
  • keybinds
  • windowrules
  • hyprland info
  • misc hyprland commands(change workspace, move active window etc...)(dispatchers)
  • a nice way to handle colors
  • build settings.py file based on current hl version
  • get config values from the current hyprland config instead of using default values

getting binds still dont work

  • docs
  • widgets??

Install

git

from git

pip install git+https://github.com/hyprland-community/hyprland-py

release

from pypi

pip install hyprland

Example

change window border to a random number between 0 and 20 everytime a new window is opened

import hyprland
from hyprland import Bind, BindFlag

class Config(hyprland.Events):
    def __init__(self):
        self.c = hyprland.Config()
        super().__init__()

    async def terminal(self):
        await hyprland.Dispatch.exec("kitty --single-instance")
    
    async def on_connect(self):
        print("Connected to hyprland")
        
        await self.c.add_binds([
            # general binds
            Bind(["SUPER","m"],hyprland.Dispatch.exit),

            # mouse binds
            Bind(["SUPER","mouse:272"],"movewindow",BindFlag.mouse),
            Bind(["SUPER","mouse:273"],"resizewindow",BindFlag.mouse),

            # keyboard binds
            Bind(["SUPER","return"],self.terminal),
            Bind(["SUPER","q"],hyprland.Dispatch.kill_active),
        ])

        # workspace binds
        for i in range(1,11):
            await self.c.add_bind(Bind([f"SUPER",str(i) if i!= 10 else str(0)],hyprland.Dispatch.workspace,args=[i]))
        
        for i in range(1,11):
            await self.c.add_bind(Bind([f"ALT",str(i) if i!= 10 else str(0)],hyprland.Dispatch.move_to_workspace,args=[i]))

    
c = Config()

c.async_connect()

Metadata

Release files for hyprland 0.2.54

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 0.2.54
File Size Uploaded Provenance Actions
hyprland-0.2.54.tar.gz 14.0 kB Without provenance Details for hyprland-0.2.54.tar.gz

Built distribution (wheel)

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

Total release size: 29.2 kB

Release files / hyprland-0.2.54.tar.gz

Download URL hyprland-0.2.54.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
707950ace8e2478bfaec09dc18b6bc75c38cf2a2399b71eaf47fbb73dfcae233
BLAKE2b-256 checksum
How to use checksums
cfeefbe6d7d04fdbe7dc52bda776a78af7b649a76db0c81c53c7c64d4e972c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / hyprland-0.2.54-py3-none-any.whl

Download URL hyprland-0.2.54-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
147ce775ef09f5ef7e906232726893ba9169146693b07cb0126474ceca8863e2
BLAKE2b-256 checksum
How to use checksums
2b8e438c94dd750d63e386c2fae69f2d7df8195d54bc29d7df50ab4a623069e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for hyprland 0.2.54

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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