Skip to content

Instantly share code, notes, and snippets.

@mrichar1
Created February 10, 2017 21:59
Show Gist options
  • Save mrichar1/069daeb1846779d0d5dcb1f601c7c888 to your computer and use it in GitHub Desktop.
Save mrichar1/069daeb1846779d0d5dcb1f601c7c888 to your computer and use it in GitHub Desktop.
Change i3 split based on current window dimensions
import i3ipc
i3 = i3ipc.Connection()
def on_window_focus(i3, e):
cont = e.container
if cont.rect.width < cont.rect.height:
print("splitv")
i3.command("split vertical")
else:
print("splith")
i3.command("split horizontal")
i3.on("window::focus", on_window_focus)
i3.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment