This script uses the i3ipc python module to switch the layout splith / splitv for the currently focused window, depending on its dimensions. It works on both sway and i3 window managers.
Does any sway or i3 user miss the way dwm tiles the screen? In the depths of hell r/i3wm I’ve found a script capable of doing this on i3. Based on the
i3-py module, it works with i3 only, but it’s easy to do the same with
python-i3ipc. For now I added such a feature to my wsdnames, but it would be easy to make a standalone script, if someone finds it funny.