altdesktop / i3ipc-python

🐍 An improved Python library to control i3wm and sway.
http://i3ipc-python.readthedocs.io
BSD 3-Clause "New" or "Revised" License
858 stars 108 forks source link

How do you use keybinds? #206

Open ghost opened 1 year ago

ghost commented 1 year ago

Title says it all. I understand that this is an inappropriate space for something like this, but there is no discussions page so I had to make do with this.

I have a function func_binds which is supposed to check e.binding.symbol for the matching key, and if it find the key it will make the window effectively fullscreen. This is how I have it implemented

# Define binds
def func_binds(i3, e):
    # Fullscreen
    if e.binding.symbol == f"{MOD}+Shift+Up":
        # Run i3 commands
        i3.command(f"resize set {WIDTH} {HEIGHT}")
        i3.command("move absolute 0 0")

# Connect key press
i3.on('binding', func_binds)

When I run it I get no errors but nothing happens, so what am I doing wrong?