Running bash commands in the Multitouch app

Ryan Hanson
Ryan Hanson
Published in
3 min readAug 13, 2019

There’s a couple of big new changes in Multitouch v1.16 that give it a good deal more flexibility to improve your workflow: the ability to execute bash commands, and global keyboard shortcut triggers. Any gesture can be configured to execute a bash command, but in this post I’ll walk through both new capabilities by configuring a keyboard shortcut to execute a bash command and show us the weather.

Start by clicking the new keyboard toolbar button in the preferences window. Adding a keyboard shortcut follows the same flow as adding a gesture and should be pretty straightforward. It’s the only option currently available on the keyboard view. Once you’re in the configuration panel, you can record the shortcut. For the demo, I’m recording ⌃⌥⌘W as the shortcut for our weather command.

From the action dropdown, pick Execute; Bash command. In the input field that is displayed, enter: curl wttr.in?0. Check the box for “Show output” so that we can see the results of our bash command.

Now, execute the keyboard shortcut! That’s all there is to it.

Behind the Curtains

The bash commands are executed with a launch path of /bin/bash, so in the very unlikely situation that you are running with a nonstandard setup this is something worth knowing.

The bash commands are executed using “bash -c”, so bash is directly interpreting the string value you provide in the input field.

If you are running Multitouch on multiple Macs with iCloud preferences syncing, note that the bash string is not synced. This might change in a future release.

The viewing window that displays your results is just a simple log viewing window built for this task of displaying output. As such, it’s not a shell emulator and doesn’t have a lot of features in an application like Terminal, such as displaying colors. The door is open for you to execute whatever bash script you want that can open up a terminal and execute commands if you wish.

Also in v.1.16

You might have noticed that the keyboard shortcut triggers have the full selection of actions that a normal gesture would have. Obviously some of these make more sense than others for keyboard shortcuts, but it’s worth noting that this allows Multitouch to behave as a pretty powerful, customizable window manager. This version also adds a handful more window management actions that were released in v0.3 of Rectangle.

--

--