Using the compiz grid plugin, Unity supports placing windows, one at a time, in a tiled-like fashion. However, there is no support for tilling a workspace in one fell stroke. That is something which users of dwm, wmii, i3, xmonad, awesome, qtile etc come to expect.
A few years ago I ran across a python script called stiler which tiled all windows, mainly using wmctrl. I’ve made a few updates to make that work cleanly in Unity, and have been using that for about a week. Here is how it works:
windows-enter is mapped to “stiler term”. This starts a new terminal (of the type defined in ~/.stilerrc), then tiles the current desktop. windows-j and windows-k are mapped to ‘stiler simple-next’ and ‘stiler simple-prev’, which first call the ‘simple’ function to make sure windows are tiled if they weren’t already, then focuses the next or previous window. So, if you have a set of windows which isn’t tiled (for instance you just exited a terminal), you can win-j to tile the remaining windows. Windows-shift-j cycles the tile locations so that the active window becomes the first non-tiled, etc.
This is clearly very focused on a dwm-like experience. stiler also supports vertical and horizontal layouts, and could easily be taught others like matrix.
If this is something that anyone but me actually wants to use, I’ll package properly in ppa, but for now the script can be found at
http://people.canonical.com/~serge/stiler .
Amazing! I love window-management tweaks in Unity (basically that’s the biggest reason I use Unity all the time, on all of my “desktop” devices). This is YET another improvement in this regard. I wish your script will find its way in the mainline Unity 7 (and 8, why not?).
But could you please explain for a dumb desktop user (1) how exactly should I run it? (2) What if I want the features be automatically there every time I log in?
Hi,
Note that this isn’t a part of unity itself, it’s just a script which basically uses the EWMH window manager extensions to ask Unity to tile windows. Getting an actual proper tiling layout into Unity would be awesome. I’ve considered trying my hand at it myself. Perhaps Unity8 has an architecture that makes a plugin for that easy, I haven’t looked.
To use this right now, you would place the script into /usr/bin, make it executable (sudo chmod 755 /usr/bin/stiler), then use the keyboard shortcuts editor to define some new shortcuts:
If/when I package this I hope to use gsettings to have the package postinst itself add the shortcuts, so you wouldn’t have to know how to do any of this.
Thanks a lot for the detailed response. I just put the script in in /usr/bin and made it executable. Before defining the shortcuts, I simply ran the commands in terminal:
$ /usr/bin/stiler
Traceback (most recent call last):
File “/usr/bin/stiler”, line 130, in
(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize()
File “/usr/bin/stiler”, line 60, in initialize
current = filter(lambda x: x.split()[1] == “*” , desk_output)[0].split()
IndexError: list index out of range
$ /usr/bin/stiler simple-cycle
Traceback (most recent call last):
File “/usr/bin/stiler”, line 130, in
(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize()
File “/usr/bin/stiler”, line 60, in initialize
current = filter(lambda x: x.split()[1] == “*” , desk_output)[0].split()
IndexError: list index out of range
$ /usr/bin/stiler simple-next
Traceback (most recent call last):
File “/usr/bin/stiler”, line 130, in
(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize()
File “/usr/bin/stiler”, line 60, in initialize
current = filter(lambda x: x.split()[1] == “*” , desk_output)[0].split()
IndexError: list index out of range
$ /usr/bin/stiler term
Traceback (most recent call last):
File “/usr/bin/stiler”, line 130, in
(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize()
File “/usr/bin/stiler”, line 60, in initialize
current = filter(lambda x: x.split()[1] == “*” , desk_output)[0].split()
IndexError: list index out of range
Am I doing something wrong? BTW I have Ubuntu 14.04.2.
Yeah this is another reason a package would be good – you probably need some dependencies.
Try:
sudo apt-get install wmctrl xdotool x11-utils
You will also want to edit ~/.stilerrc and change the ‘Terminal = st’ line to ‘Terminal = xterm’ (or install st from http://git.suckless.org/st).
Wow! It’s working nicely! Thank you for the nice work. Now let’s define the shortcuts because I definitely like to have this for my window management.
I have never used tiling window managers before so I don’t know how exactly they tile windows. But I find the current configuration pretty sensible. It takes time until I realize my exact taste (I mean, window configuration) regarding tiling. One immediate problem that I see is that since the Setting window (the one I just used to define the shortcuts) is not resizable, it cannot be nicely tiled, and it is usually covered under other windows (given that I have currently 5 windows open in the active workspace).
But this script (and I guess you) are awesome. Really.
And I wish there was a way to switch the window positions/sizes to the way before tiling. In Unity, if you snap a window to the left half on the screen (Ctrl+Super+Left), for example, the previous size/position of the window is still remembered, and you can roll back by dragging the title bar down.
Works great! Also got tripped up by deps. For 15.04 it was resizing the desktop (strange effect!) until I added “Desktop” to the excluded window list (guess I can remove x-nautilus-desktop). Mapped super-shift-k to swap.
Interesting. I wonder whether ‘Desktop’ is something no longer needed there in wily…
FWIW I haven’t been able to use this for a few months because unity won’t start for me. (some personal config file badness, because guest user can log in). I should straighten that out soon.
A ppa would be great. Thanks for the instructions you’ve given though.
Where can I download this? The link in the blog post doesn’t work.
Thank you!
Sorry, my people.canonical.com was removed when I left canonical. I’ve pushed the code to http://github.com/hallyn/stiler .
I have no idea whether it still works, as unity hasn’t really worked for me for about a year. But if you use it and have some changes, I’ll happily accept pull requests. Thanks!