GithubHelp home page GithubHelp logo

folkerd0c / hyprland-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyprland-community/hyprland-py

0.0 0.0 0.0 109 KB

An unoffical async python wrapper for hyprland's IPC [maintainer=@flick0]

License: MIT License

Python 100.00%

hyprland-py's Introduction

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

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

hyprland-py's People

Contributors

flick0 avatar folkerd0c avatar gergelypolonkai avatar evangelospro avatar kagutaba256 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.