Skip to main content

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

Project description

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
  • 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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyprland-0.2.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyprland-0.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file hyprland-0.2.tar.gz.

File metadata

  • Download URL: hyprland-0.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for hyprland-0.2.tar.gz
Algorithm Hash digest
SHA256 e07b9167934ad1407fdf7a6e3248a5e128fa49e48eeadc3fd413a55979cbf4dc
MD5 c1f3d1e29f2477a1fbfac5102942ac6f
BLAKE2b-256 40c701c410a1e2074021057ddd319d690cb961f0c5dd8e45fe505c64f61d7e6d

See more details on using hashes here.

File details

Details for the file hyprland-0.2-py3-none-any.whl.

File metadata

  • Download URL: hyprland-0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for hyprland-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1da5acf6446d8f4f8beb04afddf033fac430ffc596501abdc6e779e89ddb8f64
MD5 d327c2c9534dd20166836e8454dc21b5
BLAKE2b-256 a6260e675f55d6710ebb06cebd552e9ee5876413e96e7b7f5afa54fa452f1bd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page