74 comments

[ 2.8 ms ] story [ 149 ms ] thread
I like Spectacle[0] for this. It works for any window, not just terminals.

Though what I really want is native xmonad in OSX.

0. http://spectacleapp.com/

Spectacle has worked well for me for years on OS X. I highly recommend it. I completely agree with you on xmonad though (or any true tiling window manager).
Many of these sorts of apps reposition windows and scale to half or quarter of the screen. What I really want is intelligent repositioning so that none of my windows overlap. (xmonad, without resizing the windows.) Failing that, magnetic edges.

Unfortunately, what I want is really the job of a window manager, or should be done at the OS level. On the Mac, there is no true user-serviceable window manager that can be replaced.

I'm a big fan of the BetterSnapTool available on the App store. It costs $1.99, but it works with all widows and has drag-to-snap, shortcuts keys, etc.

I'm still surprised Apple hasn't just incorporated this into OSX.

BetterTouchTool is free, and strangely incorporates the same window snapping functionality as it's sister: BetterSnapTool. I've always been a little confused by the paid download for BetterSnapTool... Unless I'm missing something you can get all the same functionality and more (mouse and trackpad configuration etc) with BTT.

http://www.bettertouchtool.net/

"ll" may not be the best choice of default alias - it's pretty common for people to already have it aliased to "ls -l" (or -la, or -lah, or whatever their preferred default flavor), especially for the type of power users this is targeted toward.

I realize this is a bit of a moot point since the user can always change the alias, but it's generally better UX if the default is something most people will use.

I agree, the ll alias would be the first thing to change for me.
Agreed, but If created an alias that didn't eventually collide with another I would be shocked!
Agreed as well. Seems like 'lh' would be a better default (unless that defaults to something else I don't know of).
I know about it, but I didn't have an 'll' alias so i picked it just to be consistent with 'rr'. If you wish you can configure the aliases in the install.sh file (if you decline to overwrite an existing alias it asks you to type another one) :)
I use Emacs in full screen mode on OSX. Then I split into usually 3 or 4 panes and launch a terminal in one of them. Then I have a todo list in another and the code I'm editing in another.

Works great for my use.

Use the free Bettertouchtool (and also helpful e.g. for middle clicking links with three finger tab) and enable "Window snapping".
I think you mean Bettersnaptool.
no, really bettertouchtool ! Actually I've just found out that booth tools are from the same author. Bettersnaptool functionality is included in Bettertouchtool and there it is for free: http://www.bettertouchtool.net
Yup, another thing it does for me is enable back/forward buttons on my mouse.
You should look at SizeUp, it basically does the same thing except for any window :D
+1 for SizeUp.
I use ShiftIt (https://github.com/fikovnik/ShiftIt), which is similar, as I recall, but free. Has keyboard shortcuts. I use it for pretty much all my windows.

(A few years ago, before I started using OS X, I wrote something similar for Windows, for use with AutoHotKey: https://github.com/tom-seddon/align_window2)

Yes - have been using shiftit for years now and love it.

I didn't even need to program or customize any hot-keys since everything I want to do (full screen, half screen, quarter screen) is already built into a hotkey.

Yeah, I had this problem a long time ago. Installed SizeUp + Divvy, but I've just used SizeUp and haven't looked back.
I use SizeUp as well. One really nice feature is that there are keyboard shortcuts to move windows from one monitor to another. I tried some other OSX window managers but they were buggy, SizeUp ended up working the best.
I know that there are loads of universal window managers, but I wanted a one with a terminal API ;)
As always, I recommend Hammerspoon [1] when these sorts of things come up. If you can program Lua (or you know JS or Python, which is close enough), you can create any kind of window management system you want, saved layouts, contextual layouts across multiple monitors, adjust wifi/sound based on location, tab multiple windows, and a lot more.

There are a lot of hammerspoon configurations around that will give you some cool ideas. Mine is below [2].

1. http://www.hammerspoon.org/

2. https://github.com/STRML/init/blob/master/hammerspoon/init.l...

I second Hammerspoon. It fits perfectly between being barebones enough to not get in your way and having enough features to do just about anything you want.

Here's my configuration file.

https://github.com/Linell/hammerspoon-config

Guys - thanks for informing us about Hammerspoon and sharing your configs - I've learned a lot in the last 5 minutes and solved some problems that have plagued me on OSX for years. Kudos to you and the Hammerspoon team, its a terrific tool!
Hammerspoon looks quite good (and thank you for writing up usage instructions - I like the "mash" concept :), but part of me wonders whether or not this deserves a port to node. The reason why would be to leverage something like D3 to do window layout (I want either a treemap or a force-directed graph).
It would likely be less effort to port those parts to Lua instead of the whole system to node. Does D3 even run headless anyway?
I guess you could have it display a WebKit window.
It wouldn't be a window manager then though...
The naming of mash if awesome, mash! I'd like to recommend to set a hyper key using karabiner, such as I have done with tab: http://pastebin.com/raw.php?i=1EbhTEjd

This way if you press tab on it's own it still behaves as the tab key, but combined with another key it acts as Hyper, or mash.

I also love the "Shift to Shift (+ When you type Shift only, send the appropriate parenthesis)" option, and have my caps-lock mapped to control, with karabinier doing: Control_L to Control_L (+ When you type Control_L only, send Escape)

That's pretty cool! In my config above, I ended up just using caps lock. It's a bit of a pain to remap, you have to use both Seil and Karabiner, but once you get it, it's very convenient.

The entire cmd+shift+alt+ctrl keymap space is open, except with the (surprising) inclusion of cmd+shift+alt+ctrl+., which does a sysdiagnose. So I added a warning about that.

Interesting, I have been using mjolnir for some time for basic bindings (window resizing, jump to named windows). What does hammerspoon offer over it?
My understanding is that Hammerspoon does not require one to use luarocks for all of the extensions. Basically, more batteries included...
Hammerspoon is actually just a fork of Mjolnir from a few of the more active community members.

It has a bit more modules and whatnot and emphasizes ease of use more than Mjolnir. It comes pre-packaged so that you don't need to bother with Luarocks and finding each and every package that you want. It is also under active delevopment. .Steven Degutis, the Mjolnir creator and maintainer, has said that he won't be doing anything other than merging necessary pull requests.

So really, for what you're using it for, probably not much. It's almost a matter of preference.

I migrated from Slate [1] to Hammerspoon during a reinstall without any regrets so far. I've also noticed the things I always wanted to do with ControlPlane [2] are perfectly doable with Hammerspoon, if you put some time into reading the docs and api (they are really good). (Basically switching bluetooth on/off when I connect my keyboard, and quiting networking apps when I switch off WiFi without a cable connected, like droplr, dropbox...)

The most powerful thing about Hammerspoon seems that you build your .hammerspoon/init.lua with time, and as things tend to frustrate you more often, you put time into looking up how to optimise things by writing lua, oh and there's a console/repl, yay! A bit like my .vimrc really.

Btw, I use a Hyper-key that is mapped using karabiner [3], here's my private.xml [4]

1. https://github.com/mattr-/slate

2. http://www.controlplaneapp.com/

3. https://pqrs.org/osx/karabiner/

4. http://pastebin.com/raw.php?i=1EbhTEjd

A lot of this was inspired by Steve Losh, who does awesome stuff! checkout http://stevelosh.com/blog/2012/10/a-modern-space-cadet/ if you like this sort of stuff!

I am aware that there are lots of universal window managers, but I just wanted something simple that would have a terminal API. This is why I've created termtile
All you need is Moom for every window, not just terminal. http://manytricks.com/moom/
I have installed Breeze which seems to be very similar. But I rarely end up using it. Its top-bar menu is too slow to use, and I can never remember the hotkeys for positioning.

The interesting part of this solution is realising that for terminals, using the mouse nor long complicated keyboard shortcuts are needed. Terminals have text input, you can type where the window is supposed to go. There commands can be memorable, and there is no risk of collision with other global hotkeys.

I agree, which is why I absolutely adore Amethyst[0]. It is a "clone", if you will, of xmonad -- it's automatic, and keyboard shortcut driven entirely. No menu bar icon needed -- all windows snap to the grid to fill the screen by default, you can adjust the sizes on the fly, you can swap layouts with a single shortcut and viola! I highly recommend it, it used to be quite buggy but I've had zero issues in the last few months. @ianyh is an amazing developer!

[0] https://github.com/ianyh/Amethyst

Nicely structured AppleScript (which is not an easy feat).
Yes, I concur .. for me this project not only has some proper Applescript to learn from, but its install script is genius as well, although it has a bug or two, which you'll see if you try to add an alias for a command you already have ..

Still, a very interesting little bit of scripting to solve a common, age-old problem.

Thanks! It's nice to hear that!

What is the bug you're talking about?

It found a conflict with an existing alias .. 'ul' I think it was .. and then all other aliases were considered in conflict too, even though they for sure were not. On OSX, 'ul' is the 'underline utility' from BSD, dunno if that is worth knowing.

I just hit enter and it soldiered on and then I manually changed the aliases in my .bashrc file ..

I am aware of 'ul' conflict, but I haven't heard of it before, so I just hoped that it's not popular :x If you've found a bug in installation script then please post an issue at GitHub :)
What is the real reason to make this tool platform-specific?
From the read me: "All scripts are written in AppleScript, so they are unfortunately limited to OS X at the moment."
Try making a cross-platform one! Maybe you'll find out ;)

(Less cheeky response: no two platforms handle this stuff in the same way. You'd be able to share such a small amount of code between platforms that you'd be better off just duplicating that code rather than trying to create some kind of abstraction. This is true even if you decided to start out by not using something entirely OS X-specific such as AppleScript.)

The tools it builds on are platform specific. I don't see a lot of ubuntu boxes that support AppleScript.
The problem it's trying to solve is also mostly platform specific. On windows and most Linux DEs you usually have default keybindings to move windows to the right half/left half/fill the screen.
I'm an i3 Linux user, and it's always sad to see the state of tiling window management on OS X. I use OS X on my work machine, and while I'm able to mimic some of i3's behavior on OS X, it's never quite the same, and I always find it frustrating.

There are a number of tools that provide some subset of the functionality, but they always lack some critical piece (oftentimes FFM, multi-monitor support, or window containers).

I'm curious, what tools/configs do you use to mimic i3 on OS X? I'm also an i3 user, but currently using OS X for work.
One of the more frustrating bits for me is that on OSX there are four modifiers (shift, control, option, and command), but none of them is exclusive to interacting with the "window manager". There's a lot of interface dissonance when I interact with anything over ssh (because "cmd" takes the place of an "alt" key), or use X forwarding.

I've dedicated Mod4 to interacting with my window manager for over a decade and it's sensible. Mod1 and control (and, if absolutely necessary, shift) are plenty for keyboard shortcuts for apps.

Another (not yet mentioned here) tool is Mjolnir. It requires some lua scripting but seems to be really flexible.

I stick with bettertouchtool combined with some keyboard shortcuts though.

Just looking at the plethora of solutions for this problem, that are recommended in this thread, makes me think that there is something here that is being radically missed by the OS decision-makers that don't implement these kinds of tiling features by default in the OS. So many solutions to the same problem! Surely this is a sign that there are features missing in the Window manager, which should be making it into the OS at some point?
Nice, although I think there should also be an 'fs' option for Full Screen.
I didn't include it, because OS X can already make the window full screen. Do you think it would be useful just to resize the window without creating a new desktop?
It's not longer being worked on, and forked at https://github.com/mattr-/slate

But honestly I switched to Hammerspoon and with some searching/learning lua/copy-pasting have the same functionality, and it's even more extendable. If you can describe what you want to do with the windows/current app/whatever, you can probably write it in lua.

Good idea to have a 'leader' (ala Vim style) and then have the intuitive shortcuts follow. Example 'zll' instead of 'll'. ll is almost always 'ls -l'.
I admit I am boring. I use the 'Save Windows as Group' feature in a tiled four square, found under the Window menu in Terminal.app

iTerm2 handles split panes quite nice as well.

Hey guys, I'm a creator of termitile. Many of you have pointed out that there are lots of window managers for OS X and my intention wasn't to create just another one. What I really needed was a bunch of script that I could alias and use directly from the terminal without cluttering my global keyboard shortcuts. I couldn't find any other programs that had a terminal API, so I've just hacked this one :)

So just to be clear, it's not intended to be a replacement for Amethyst, Divvy, or any other universal manager, but just a quick solutions just for the terminal, because you can control it with regular commands!

I hope you like it!