
Terminal Window Manager for OS X - nimitkalra
https://github.com/apaszke/termtile
======
STRML
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/](http://www.hammerspoon.org/)

2\.
[https://github.com/STRML/init/blob/master/hammerspoon/init.l...](https://github.com/STRML/init/blob/master/hammerspoon/init.lua)

~~~
Linell
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](https://github.com/Linell/hammerspoon-config)

~~~
javajosh
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).

~~~
yoklov
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?

~~~
therein
I guess you could have it display a WebKit window.

~~~
yoklov
It wouldn't be a window manager then though...

------
KeytarHero
"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.

~~~
apaszke
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) :)

------
ef4
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/](http://spectacleapp.com/)

~~~
merb
Or Divy, but it costs money

~~~
Amanjeev
I have been using Magnet (formerly Window Magnet).
[http://magnet.crowdcafe.com](http://magnet.crowdcafe.com)

------
apaszke
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!

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

~~~
therealmarv
ever tried
[https://github.com/ianyh/Amethyst](https://github.com/ianyh/Amethyst) ? It
does the job pretty good.

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

~~~
jefvader
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/](http://www.bettertouchtool.net/)

------
therealmarv
Use the free Bettertouchtool (and also helpful e.g. for middle clicking links
with three finger tab) and enable "Window snapping".

~~~
mjcohen
I think you mean Bettersnaptool.

~~~
therealmarv
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](http://www.bettertouchtool.net)

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

------
Walkman
All you need is Moom for every window, not just terminal.
[http://manytricks.com/moom/](http://manytricks.com/moom/)

~~~
ProblemFactory
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.

~~~
girvo
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](https://github.com/ianyh/Amethyst)

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

~~~
philsnow
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.

------
fit2rule
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?

------
ratsimihah
It's cool but
[https://github.com/jigish/slate](https://github.com/jigish/slate) ?

~~~
lawry
It's not longer being worked on, and forked at
[https://github.com/mattr-/slate](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.

------
aleem
Bears mention here, Spectacle[1] is a general purpose window manager which
offers the same features using keyboard shortcuts for any OSX window.

[1]:
[https://github.com/eczarny/spectacle](https://github.com/eczarny/spectacle)

------
ilanco
If someone is interested, the same can be accomplished on X by using xdotool
[1].

[http://www.semicomplete.com/projects/xdotool/](http://www.semicomplete.com/projects/xdotool/)

------
krishna2
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'.

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

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

------
steveax
Nicely structured AppleScript (which is not an easy feat).

~~~
fit2rule
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.

~~~
apaszke
Thanks! It's nice to hear that!

What is the bug you're talking about?

~~~
fit2rule
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 ..

~~~
apaszke
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 :)

~~~
fit2rule
Issue has already been reported:
[https://github.com/apaszke/termtile/issues/15](https://github.com/apaszke/termtile/issues/15)

Had the same problem as those guys.

EDIT: (for those reading) .. the issue has now been fixed. Kudo's!

------
brandonmenc
TotalTerminal [1] with tmux works well.

[1] [http://totalterminal.binaryage.com](http://totalterminal.binaryage.com)

------
cjfont
Nice, although I think there should also be an 'fs' option for Full Screen.

~~~
apaszke
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?

------
smpetrey
why not just install a global window manager?
[http://spectacleapp.com/](http://spectacleapp.com/)

------
entelechy0
You should look at SizeUp, it basically does the same thing except for any
window :D

~~~
to3m
I use ShiftIt
([https://github.com/fikovnik/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](https://github.com/tom-seddon/align_window2))

~~~
rsync
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.

------
pekk
What is the real reason to make this tool platform-specific?

~~~
to3m
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.)

