Manipulate OS X windows with script
Asked Answered
Q

1

25

Ok, so I'm trying to make my setup super simple by creating a script that I can run in the morning that will launch all the applications that I use in the day and lay them out across my 'spaces' how I like them.

This was going ok and I was easily able to have a bash script launch the apps and then call to an AppleScript to move and resize their windows.

However, I like to use the new El Capitan feature and have some of my spaces as 'split view' spaces. E.g. Full screen Xcode/Terminal split. I can't seem to find a way to control this via a script.

Tl;dr Does anyone know how to get a bash script/AppleScript to put two applications into 'split view' on OS X El Capitan?

Quirites answered 14/6, 2016 at 8:1 Comment(3)
I, for one, would like to see this magical script, even before the split-screen fix.Elongate
I would also like to see this script working. Looks really useful.Baseline
Have you considered trying Automator?Rufina
A
8

Looks like that first bit about launching and full-screening apps can be done with a fairly simple script, though it requires enabling Accessibility permissions first. It, however, won't do the split-screen bit.

I kept looking though and Better Touch Tool (pay what you want, $4.49 minimum) seems to get the closest of anything I could find, allowing you to trigger Full Screen mode and bring up the split screen Expose selector in the same action. It seems to be doing this by emulating a long mouse down on the full screen window control button (the green one in the top left). What you get is this:

Safari entering Full Screen mode with spilt-screen Expose view

I've been playing around with this and it seems there might be a (so far seemingly very un-intgelligeble, though reliable) way to control the order of full screen apps and trigger an app into split screen mode in a situation where that previously full-screened app is the only option available for splitting the screen.

For example, given the following, accomplished by launching iA Writer into full screen (space 2) via +^+F:

enter image description here

Focusing Safari and using Better Touch Tool to trigger split screen mode results in:

enter image description here

... Only one split screen app, even though there's several apps still running.

From this position you could use the "move to position" action in BTT and trigger a click on the only available app— I would think this could theoretically accomplish what you want, although it's convoluted and a bit suspect.

All that being said, it seems like the only way to get two apps launched into split screen mode without touching the mouse, since this could all be a BTT workflow you trigger from an Automator script. Digging further, you might be able to learn how BTT accomplishes their actions and write a program that does this for you, but we're already way beyond bash or simple cli scripting.

I personally just use Spectacle and tmux to zoom my windows around, though I admit, automated split screen would be somewhere close to live changing.

Alegar answered 16/11, 2016 at 6:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.