Last active
January 16, 2020 01:21
-
-
Save nwg-piotr/e5ec2733740d80fa12b4aee5a893932e to your computer and use it in GitHub Desktop.
This snippet uses i3ipc python module to print dimensions of just focused container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from i3ipc import Connection, Event | |
i3 = Connection() | |
def print_dimensions(i3, e): | |
try: | |
con = i3.get_tree().find_focused() | |
rect = con.rect | |
print("width: {}, height: {}".format(rect.width, rect.height)) | |
except Exception as e: | |
print('Error: {}'.format(e)) | |
def main(): | |
i3.on(Event.WINDOW_FOCUS, print_dimensions) | |
i3.main() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment