Created
February 10, 2017 21:59
-
-
Save mrichar1/069daeb1846779d0d5dcb1f601c7c888 to your computer and use it in GitHub Desktop.
Change i3 split based on current window dimensions
This file contains hidden or 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
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