Script a repeatable demo with a command-line keyboard overlay

To make a demo repeatable, put the overlay’s setup in a script, so every take starts with the same look, the same place on screen and the same labels on the keys. Typebar has a command-line tool, typebar, which you install from Settings > Automation, and it also answers typebar:// links that a script can open with open -g. The script sets the stage. You still press every key yourself, because Typebar’s automation never types or presses keys for you.

That split is the useful part. The things that drift between takes (which theme is on, where the board sits, what is left on the keys from last time) are exactly the things a script can fix, and the part viewers came to see, your hands doing the work, stays real.

Why script the overlay at all

A demo rarely gets recorded in one sitting. You record the intro on Monday, redo step three on Wednesday, and patch a mistake on Friday. In between you used the overlay for something else, moved it to another corner, tried a new theme. When the takes are cut together, the board jumps from one corner to the other and changes color halfway through, and viewers notice.

The same goes for a live demo. The setup you rehearsed at your desk has to be the setup on stage, on a projector, maybe on a different Mac. Clicking through Settings from memory five minutes before you go on is how things get missed.

A script fixes both. Run it before every take, or before you walk on stage, and the overlay is in the state you chose, every time.

Install the typebar tool

Open Typebar’s Settings, go to the Automation pane, and install the command-line tool. It goes to ~/.local/bin/typebar.

Then open Terminal and check that it answers:

typebar themes list

This prints the themes Typebar has, so you can check a name before you put it in a script. typebar layers list does the same for your layers.

If zsh says command not found, the folder is not on your PATH. macOS does not include ~/.local/bin by default. Either call the tool by its full path, ~/.local/bin/typebar, or add this line to ~/.zshrc and open a new Terminal window:

export PATH="$HOME/.local/bin:$PATH"

The pieces a demo script uses

Three kinds of commands cover almost everything a demo needs: the typebar tool, typebar:// links, and shortcuts you build in the Shortcuts app with Typebar’s actions.

Command What it does
typebar themes list Lists the themes by name
typebar layers list Lists your layers by name
typebar show --position topRight --hide-after-ms 3000 --symbol q=star.fill Shows the board at the top right with a star on Q for three seconds, then puts it back as it was
open -g "typebar://profile?name=Presenting" Switches to the Presenting profile
open -g "typebar://layer/show?h=s:arrow.left&j=s:arrow.down&k=s:arrow.up&l=s:arrow.right&fill=blank" Puts arrows on H, J, K and L and takes the labels off the other keys
shortcuts run "Hide Typebar" Runs a shortcut you built with the Hide Typebar action and named Hide Typebar

The -g in open -g tells macOS not to bring Typebar to the front, so the app you are demoing keeps focus. That matters more than it sounds: a script that leaves the wrong app in front means your first keystroke goes somewhere else.

The Shortcuts app adds seven Typebar actions: Show Typebar, Hide Typebar, Toggle Typebar, Set Theme, Set Profile, Show Layer, and Turn Click to Type On or Off. Build a shortcut with one of them, give it a clear name, and macOS’s own shortcuts run command runs it from any script. Show and hide an on-screen keyboard from the Shortcuts app walks through building them.

Make a profile first, then script it

The most useful thing a script can switch is a profile, because a profile keeps the whole setup: the look, the mode, sizes and places on screen, the pill, the mouse effects and the sounds. One link then restores all of it.

So before you write the script, set things up by hand once:

  1. Arrange the overlay the way you want it in the video: Keyboard, Pill, or both, at the size and in the place you want.
  2. Pick the theme, the pill settings and any mouse effects, such as click ripples.
  3. In Settings > Profiles, click + to add a profile from your current settings. Give it a one-word name, such as Demo, so it goes into a link exactly as it is.

Now the script needs one line for all of that. Typebar also comes with Recording, Presenting and Learning profiles, which you can use as they are or change. One setup for recording, another for teaching covers profiles in more depth.

A demo script, step by step

Here is a script for a recorded take. Save it as demo.sh in the folder with your demo files, and run it with zsh demo.sh.

# demo.sh: sets the stage for one take

# 1. The whole look: theme, mode, size, place, pill, mouse
open -g "typebar://profile?name=Demo"
sleep 1

# 2. Arrows on H, J, K and L for the navigation part
open -g "typebar://layer/show?h=s:arrow.left&j=s:arrow.down&k=s:arrow.up&l=s:arrow.right&fill=blank"
sleep 1

# 3. The app you are demoing, in front
open -a "Safari"
sleep 2

echo "Ready. Start recording."

A few notes on it:

  • The pauses. sleep 1 gives each step a moment to land before the next one. They cost a few seconds and save a confusing take.
  • The app last. Opening the demo app at the end means it is in front when you start.
  • The layer lasts while the board shows. Keys put up by a link go when the overlay hides, and the board goes back to normal. If it hides between takes, run the script again.

To put the overlay back the way you use it every day, end your session with a second script that switches to your everyday profile, for example open -g "typebar://profile?name=Learning".

Starting the recording

You can leave the recording to the usual tools. Press Command-Shift-5 (⇧⌘5) for the Screenshot toolbar, or use QuickTime Player’s New Screen Recording. If you turn on “Show when a screen recording starts” in Settings > Recording, the overlay appears by itself when recording starts and hides when it stops, so the script only has to handle the look. Make a keystroke overlay appear only while you record explains that setting.

If you want the script to start the recording too, macOS has a screencapture command with -v and -V options for video; man screencapture lists them. Your terminal app needs permission for it in System Settings > Privacy & Security, under Screen Recording (Screen & System Audio Recording in macOS 15 and later), and a short test take is worth doing before you rely on it.

Either way, record the whole display or an area that includes the overlay. The board and pill appear in recordings like any window, so a recorder set to capture a single other app’s window leaves them out.

Keep it repeatable from day to day

A script only helps if what it refers to still exists. A few habits keep it working:

  • Check names before a session. A link that names a profile or theme Typebar cannot find does nothing at all, so a typo fails quietly. Profiles are listed in the Profile section of the menu bar menu, and typebar themes list prints theme names.
  • Keep the files together. Layers are saved to files you can share, and so are themes. Keep the ones a demo uses in the demo’s folder with the script, so a second Mac, or a colleague, can set up the same board.
  • Silence the Mac too. A notification sliding in mid-take ruins it as surely as a misplaced board. Turn on Do Not Disturb from Control Center before you record, or add a shortcut with the Set Focus action and run it from the script with shortcuts run.
  • Rehearse the keys. The script cannot press them for you, and that is the point. Run the demo once with the overlay showing and watch the pill: if a shortcut name surprises you, so will your viewers.

Questions

Where does the typebar tool get installed?

In ~/.local/bin/typebar, from Settings > Automation. If your shell cannot find it, add that folder to your PATH or use the full path.

Can a script type into my demo app with Typebar?

No. Typebar’s automation changes what the board shows. It never types or presses keys for you, so every key in your recording is one you pressed.

Can I run the same script on another Mac?

Yes, as long as the profile it names exists on that Mac. Copy across any theme or layer files the demo uses, make the profile there, and one Typebar license covers up to 5 Macs.

Typebar is $9 once, with a 24-hour free trial that has everything on.