Skip to content

Instantly share code, notes, and snippets.

@zetxx
Created September 5, 2019 11:07
Show Gist options
  • Save zetxx/ddbd7ffca620f34d9b88f596479f8346 to your computer and use it in GitHub Desktop.
Save zetxx/ddbd7ffca620f34d9b88f596479f8346 to your computer and use it in GitHub Desktop.
from typing import Awaitable
import asyncio
import i3ipc
import threading
def pollTitle(c):
# i3.get_tree().find_focused().name
print(c.get_tree().find_focused().window_class)
async def run() -> Awaitable[str]:
i3 = i3ipc.Connection()
i3.on("window", lambda _p_i3, _p_e: pollTitle(_p_i3))
threading.Thread(target=i3.main).start()
asyncio.run(run())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment