Ryan Hanson
Jun 23 · 3 min read

It’s common knowledge that Apple and Microsoft have consistently copied ideas from each other, dating back to the early days. What’s absolutely crazy is that macOS never properly copied window management that was introduced in Windows 7. At the very least, it’s puzzling that Apple never built in the ability to use keyboard shortcuts to snap windows to the left or right half of the screen.

That problem has obviously been solved by a plethora of third party apps that utilize the Accessibility APIs provided by Apple. There’s actually a ton of these apps, and many can do all sorts of cool window management tricks. When there’s over 20 apps that all have this functionality, and one of them has been the top paid app in the Mac App Store for years, I think it’s quite obvious that some better window management functionality should be built into macOS by Apple. Catalina will introduce some minor improvements to what macOS has built in, but I don’t think it’s enough to justify ditching any decent third party app.

Taking these ideas one step further, I’ve always been a fan of managing my windows with macOS gestures. I had actually written the Multitouch app with this idea in mind. Up till now, I have always wired up the Multitouch app’s keyboard shortcut actions to a third party app’s keyboard shortcuts for snapping windows. It’s worked well, but it’s a little painful getting it all set up. As of Multitouch v1.14, I’ve built the window management functionality into Multitouch itself, so there is no need for another third party app to perform these actions with the trackpad or Magic Mouse.

To add this functionality to Multitouch, I thought it might be best to see what kind of open source apps there were out there that already did this. That way I could build off of some “seasoned” code instead of starting from scratch and working my way through whatever comes my way. There’s pros and cons to either way of going about it, but my path kind of laid itself out before me. The main open source window managers that could be useful to me were Amethyst and Spectacle. Multitouch is written in Swift, so my goal would be to get something in Swift that I could easily bake in. Amethyst is already in Swift, but it relied on other 3rd party libraries, and it had a lot of functionality to sift through. Spectacle is a pretty simple app, but it is Objective C (and JavaScript!?) and hasn’t been updated in a couple of years. I decided to port Spectacle to Swift and release the port as yet another open source window management app for macOS. That way I could at least give something back in exchange for the knowledge and reference code I obtained.

Porting Objective C to Swift is a topic worthy of another post, but from all of this I created an app called Rectangle. Give it a try!

Back to the main reason for all of this: adding the functionality into Multitouch. The real benefit to having this built into Multitouch over just mapping keyboard shortcuts to another window management app is that you can now perform a window management action on the window that the cursor is over, not necessarily the frontmost window. This behavior isn’t enabled by default — you’ll have to go to the preferences and check the box for “Snap window under cursor”. I’m tempted to make this enabled by default, though, because it just feels really smooth and intuitive. Try it out and let me know what you think.

Ryan Hanson

Programming. Daydreaming.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade