Sunteți pe pagina 1din 4

4/8/2016

Tiling windows in Unity | S3hh's Blog

S3hh'sBlog
Just another WordPress.com site

TilingwindowsinUnity
PostedonJune30,2015

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. Ive 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 werent already, then focuses the next or
previous window. So, if you have a set of windows which isnt 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, Ill package properly in ppa, but for now the script
can be found at
http://people.canonical.com/~serge/stiler .
Like
Bethefirsttolikethis.

Related

new stiler.py

tiling in metacity with stiler.py


With 6 comments

dvtm
In "console"

ThisentrywaspostedinUncategorized.Bookmarkthepermalink.

10ResponsestoTilingwindowsinUnity
Masoud says:
July1,2015at12:58pm

Amazing! I love window-management tweaks in Unity (basically thats 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?
Reply

https://s3hh.wordpress.com/2015/06/30/tiling-windows-in-unity/

1/4

4/8/2016

Tiling windows in Unity | S3hh's Blog

s3hh says:
July1,2015at3:47pm

Hi,

Follow

Follow S3hh's
Blog

Note that this isnt a part of unity itself, its just a script which basically uses the EWMH window manager
Get every new post delivered
extensions to ask Unity to tile windows. Getting an actual proper tiling layout into Unity would be awesome. Ive
to your Inbox.

considered trying my hand at it myself. Perhaps Unity8 has an architecture that makes a plugin for that easy, I
havent looked.

Enter your email address

To use this right now, you would


Signplace
me upthe script into /usr/bin, make it executable (sudo chmod 755
/usr/bin/stiler), then use the keyboard shortcuts editor to define some new shortcuts:
Build a website with WordPress.com

Start the keyboard settings dialog (Hit windows and type keyboard)
Choose the shortcuts tab
Choose custom
Add the following shortcuts:
win-shift-j: /usr/bin/stiler simple-cycle
win-j: /usr/bin/stiler simple-next
win-k: /usr/bin/stiler simple-prev
win-enter: /usr/bin/stiler term
If/when I package this I hope to use gsettings to have the package postinst itself add the shortcuts, so you wouldnt
have to know how to do any of this.
Reply

Masoud says:
July1,2015at3:57pm

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):
https://s3hh.wordpress.com/2015/06/30/tiling-windows-in-unity/

2/4

4/8/2016

Tiling windows in Unity | S3hh's Blog

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.

s3hh says:
July1,2015at4:14pm

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).
Reply

Masoud says:
July1,2015at4:26pm

Wow! Its working nicely! Thank you for the nice work. Now lets define the shortcuts because I definitely like to have
this for my window management.
Reply

Masoud says:
July1,2015at4:36pm

I have never used tiling window managers before so I dont 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.
Reply

Masoud says:
July1,2015at4:39pm

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.
Reply

trapnine says:
October16,2015at9:15am

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.
Reply

https://s3hh.wordpress.com/2015/06/30/tiling-windows-in-unity/

3/4

4/8/2016

Tiling windows in Unity | S3hh's Blog

s3hh says:
October16,2015at3:31pm

Interesting. I wonder whether Desktop is something no longer needed there in wily


FWIW I havent been able to use this for a few months because unity wont start for me. (some personal config file
badness, because guest user can log in). I should straighten that out soon.
Reply

8bitterness says:
November3,2015at6:04am

A ppa would be great. Thanks for the instructions youve given though.
Reply

S3hh'sBlog
The Twenty Ten Theme.

Blog at WordPress.com.

https://s3hh.wordpress.com/2015/06/30/tiling-windows-in-unity/

4/4

S-ar putea să vă placă și