Skip to content

Instantly share code, notes, and snippets.

@lukateras
Created February 22, 2023 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukateras/78d9d3dcbf40dbda147573bd12cad147 to your computer and use it in GitHub Desktop.
Save lukateras/78d9d3dcbf40dbda147573bd12cad147 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import asyncio
import i3ipc.aio as swayipc
async def main():
sway = await swayipc.Connection().connect()
tree = await sway.get_tree()
focused_workspace = tree.find_focused().workspace()
for leaf in focused_workspace.leaves():
print('{x},{y} {width}x{height}'.format(**vars(leaf.rect)))
if __name__ == '__main__':
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment