So I googled a little, and wrote some code. I was heaviliy inspired by the programs named above. And several Google Results did really help me (see References).
Usage
iTile can be found under www.jaak.de/andi/itile/itile.zip. The Archive contains an applescript and a Spark Library. I really recommend you to download Spark and import the Library file from the archive.
This way you can set up itile with ease in under five minutes.
Shortcuts in the Spark Library
The Spark Library provides you with several Shortcuts, similar to TwoUp:
- Control+Option+Command+Right/Left/Up/Down arranges the frontmost window at this Side of the Screen
- Control+Option+Command+Space maximizes the frontmost window
- Control+Option+Command+N Brings the window to "normal" size, which means it will be in the middle of the screen
Limitations
I did not get the X Window Server to work with the shortcuts. But Matlab did work, and I think that most applications that support global shortcuts do.
iTile is a little slow. (especially on the first run) This is because it has to call the SystemProfiler to get the screen size every time. I do not want to cache the results for I use my MacBook with an external monitor. Often I need to plug of that screen and iTile should work properly after this.
Currently iTile only supports two screens. As there are many case sto handle for more screens. Also these two screens will only be handled if they stand (virtually) side-by-side this means the second screen on the left or right side of the main monitor.
Possibilities of the script
You can use the iTile script to arrange your windows in different ways. The ways in the spark library are not the only ones. p.e. you could arrange your windows in the edges of your screen.
sizeFrontmost takes 6 arguments: the first two tell it in how many parts the screen should be divided horizontal and vertically. The second two arguments tell the script the position of the window in that grid. The upper left corner is 0,0. And the last two arguments tell the script how many cells the window should take horizontal and vertically.
p.e. you could create a 3 by 3 grid with the window set up in the lower left corner of the screen (0,2) taken two cells horizontal and one vertically (2,1).
Future Plans
Are no good ;)
Maybe I will extend the script to arrange not just the frostmost window, but every window by name.
And I plan to build in borders and maybe a simple transition while resizing to make the hole thing look more beautifull. Well, maybe ...
References
I used some blog/forum posts that really got my thoughts pushed in the right direction
- Daring Fireball: Getting the Size of Your Display With AppleScript, the Lazy Way
- MacScripter / How can I get the screen resolution?
- The Pretzel Blog | Computing Tips by Stephan Ritter
- » Center and resize window with AppleScript
- iThug » Applescript: Moving and Resizing Windows
- Resize Your Windows Automatically for Different Resolutions « Jeff Kelley’s Blog
- MacScripter / Reading Jon's screen size of {screen list}? This was really important especially the monitorProperties Function of paulskinner, which I took over nearly completely.