Closed eternal-sorrow closed 5 years ago
was just about to post this same issue.
both these examples misbehaves: (PS, i have limited knowledge of python and asyncio stuff, the documentation is confusing with all the examples using asyncio, i first thought that was the problem...)
#!/usr/bin/env python3
import asyncio
from i3ipc.aio import Connection
def on_new_title(i3, e):
print(f'this should only print on title change: {e.change}')
async def main():
i3 = await Connection().connect()
from i3ipc import Event
i3.on(Event.WINDOW_TITLE, on_new_title)
await i3.main()
if __name__ == "__main__":
asyncio.run(main())
#!/usr/bin/env python3
from i3ipc import Event
from i3ipc import Connection
i3 = Connection()
def on_new_title(i3, e):
print(f'this should only print on title change: {e.change}')
i3.on('window::title', on_new_title)
i3.main()
Oh, it happens not only with aio, but with old API too? I didn't test it.
UPD: yes, it does.
:+1: There's a fix in the latest release with regression tests.
When I bind for example, to the
window::focus
event (orEvent.WINDOW_FOCUS
, it doesn't matter), the handler is being executed on eachwindow
event, no matter it's change type (part after::
).