Simple shortcut for side by side window tiling in Linux
There is a nice way to arrange all opened windows side by side in Windows. By right clicking on panel you can select “Show windows side by side” and I often find useful to have two windows opened like this. It comes in handy when trying to copy some commands from browser to terminal or when copying text between editors. And I really wanted this feature in Linux.
In all mainstream Desktop Environments there is a shortcut for placing window on the half of the screen. You usually have to press Super key with Left or Right arrow to stretch window onto corresponding part of the screen. While this shortcut is useful I don’t find it convenient to place only one window at a time, because you have to switch to another window and press the same shortcut with opposite direction to lay them out nicely. I’ve tried searching for any solutions, but they are either too complex to configure or bloated with features I don’t need. So I came up with simple and elegant solution: emulating keystrokes!
I’ve written a script which sends shortcut to stretch your window to the right, then it switches to previous window and stretches it to the left. Could this be done any simpler?
You can save this script, add executable bit and bind it to a simple shortcut in your Settings. That’s it! Now you have only one key press tiling feature without installing any software. And the best part is that window stretch is still animated! Check out how glorious it looks!
The downside of this approach is having to simulate a little pause between sending keystrokes inside the script. So this whole operation is not instant. It takes 600 ms if you have animations turned on.
On a good note in GNOME pressing this key repeatedly swaps window sides. And it returns windows back to their original states if you click on titlebar and press the shortcut again. And I also discovered changing size affects both windows at once, so it is much closer to real tiling manager that I have expected. Though it behaves differently on Elementary OS so check it out for yourself! I am pretty sure it works on every major Desktop Environment you may only need to change shortcuts inside the script.