Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event change type is being ignored #126

Closed
eternal-sorrow opened this issue Aug 31, 2019 · 3 comments
Closed

Event change type is being ignored #126

eternal-sorrow opened this issue Aug 31, 2019 · 3 comments
Assignees
Labels

Comments

@eternal-sorrow
Copy link
Contributor

When I bind for example, to the window::focus event (or Event.WINDOW_FOCUS, it doesn't matter), the handler is being executed on each window event, no matter it's change type (part after ::).

@budRich
Copy link
Contributor

budRich commented Aug 31, 2019

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

@eternal-sorrow
Copy link
Contributor Author

eternal-sorrow commented Sep 1, 2019

Oh, it happens not only with aio, but with old API too? I didn't test it.

UPD: yes, it does.

@eternal-sorrow eternal-sorrow changed the title Aio ignores event change type Event change type is being ignored Sep 1, 2019
@acrisci acrisci closed this as completed in acb1eb5 Sep 1, 2019
@acrisci
Copy link
Member

acrisci commented Sep 2, 2019

👍 There's a fix in the latest release with regression tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants