AeroSpork is an i3-like tiling window manager for macOS
Project homepage: https://github.com/wbsmolen/aerospork
![]()
AeroSpork is an i3-like tiling window manager for macOS. This guide has five parts:
-
Part 1. Get started takes you from the download to your first tiled windows.
-
Part 2. How to gives the procedures for common tasks.
-
Part 3. How AeroSpork works explains the model: the tree, workspaces and monitors.
-
Part 4. Troubleshooting and bug reports tells you what to do when something goes wrong, and what a bug report needs.
-
Part 5. Config reference describes every config key.
1. Part 1. Get started
1.1. Install
AeroSpork needs macOS 13 or later, on Apple silicon or Intel.
1.1.1. Install with Homebrew
brew install --cask wbsmolen/tap/aerospork
The cask installs the app, links the CLI onto your PATH, and installs the man pages and the bash,
fish and zsh completions. If your shell does not complete aerospork commands, configure it for
Homebrew’s completions: https://docs.brew.sh/Shell-Completion
1.1.2. Install from the release zip
-
Download
aerospork-v<version>.zipfrom the releases page. The other zip,AeroSpork-<version>.zip, is the update archive. It holds only the app. -
Open the zip. Finder unpacks it to a folder named
aerospork-v<version>. -
Move
AeroSpork.appfrom that folder to/Applications. -
Optional: to use the CLI, link it onto your
PATH. Open Settings > General, and click Install… next to Command-line tool, under About. macOS asks for an administrator password, and AeroSpork linksaerosporkinto/usr/local/bin. The row shows only while neither/usr/local/binnor/opt/homebrew/binhas anaerospork. To make the link by hand instead:/usr/local/binbelongs to root, and a new Apple silicon Mac does not have it, so usesudo:sudo mkdir -p /usr/local/bin sudo ln -s /Applications/AeroSpork.app/Contents/MacOS/aerospork-cli /usr/local/bin/aerosporkDo not copy
bin/aerosporkout of the unpacked folder. It is a relative link into the app, so a copy points at nothing.
The unpacked folder also holds the man pages (manpage/) and the shell completions
(shell-completion/).
1.2. Grant Accessibility permission
AeroSpork moves windows through the macOS Accessibility APIs, so it needs Accessibility permission. The first time you open AeroSpork, macOS asks for the permission, and AeroSpork waits for it.
-
Open AeroSpork. macOS shows a dialog that asks for Accessibility access. A lock icon in the menu bar shows that AeroSpork is waiting.
-
Open System Settings > Privacy & Security > Accessibility. The menu of the lock icon has "Open Accessibility settings…", which opens that page.
-
Enable AeroSpork. Within a second, the workspace chips replace the lock icon, and AeroSpork tiles the windows on your screen.
While the lock icon shows, AeroSpork manages no windows and the CLI gets no answer.
1.3. If macOS blocks the app
Each release has a Developer ID signature and a stapled notarization ticket from Apple. Gatekeeper accepts a release, and you do not see a warning.
If you see this message, the copy you have is not a release. It is a build from source, or a download that changed in transit:
"AeroSpork.app" can't be opened because Apple cannot check it for malicious software.
-
Delete that copy.
-
Download a release from the releases page, and install it again.
To run that copy anyway, open System Settings > Privacy & Security, and click Open Anyway next to the message about AeroSpork. This is a decision to trust that copy.
1.4. Your first tiled windows
With no config of your own, AeroSpork runs the default config. Its modifier is
alt (the Option key), and it declares workspaces 1 to 9.
-
Open two or three windows, for example two Terminal windows and TextEdit. AeroSpork tiles them side by side on workspace 1.
-
Press
alt-handalt-lto move the focus left and right.alt-jandalt-kmove it down and up. -
Press
alt-shift-horalt-shift-lto move the focused window. -
Press
alt-slashto switch the layout between horizontal and vertical tiles. Pressalt-commafor the accordion layout. -
Press
alt-shift-2to send the focused window to workspace 2. Pressalt-2to go there, andalt-1to go back. -
Press
alt-shift-enterto make the focused window trade places with the next one. The focus goes along, so press it again to keep moving the window.
The default config also binds alt-shift-s to make a window sticky, and
alt-shift-minus and alt-backtick to put a window in the scratchpad and call it up.
Its comments list every binding that it generates. The menu bar icon shows the workspace on each
monitor.
You can also drag a tile by its title bar onto another tile to swap the two, and drag the edge of a tile to resize it. See Move and resize tiles with the mouse.
1.5. Make the config yours
The default config lives inside the app, and AeroSpork does not change it. The quickest way to a
config of your own is the Settings window: the first change you make there creates
~/.aerospork.toml, a copy of the default config with your change in it.
To edit the file by hand instead, copy the default config to your home folder and edit the copy:
cp /Applications/AeroSpork.app/Contents/Resources/default-config.toml ~/.aerospork.toml
chmod 600 ~/.aerospork.toml
A config can hold secrets in [exec.env-vars]. A config that AeroSpork creates, from Settings or
from an import, only your account can read. A copy that you make with cp is usually readable by
every account of the Mac, so the chmod makes it private too. AeroSpork does not change the mode
of a config that exists.
When you save the file, AeroSpork loads it at once. You do not need to restart AeroSpork or run
reload-config.
Start from a copy of the default config, not from an empty file. A key that you leave out gets its
built-in default, and that value is often different from the default config: for example, without
mod AeroSpork generates no bindings at all. See Built-in defaults and the default config.
AeroSpork does not start at login until you set start-at-login = true, or enable "Start AeroSpork
at login" in the General pane of the Settings window.
1.6. Open the Settings window
The Settings window edits the same config file. To open it, do one of these:
-
Click the menu bar icon, then click Settings….
-
Press
cmd-commawhile AeroSpork is the frontmost app. -
Open AeroSpork again while it runs.
-
Run
aerospork open-settings.
A change in a pane applies about 0.6 seconds after you make it. The Raw TOML pane applies only when you click Apply. Settings window details describes the panes and what the Settings window writes.
1.7. Updates
AeroSpork checks for updates only when you allow it. On its second launch, AeroSpork asks once whether to check automatically. To check now, click the menu bar icon, then click Check for updates….
AeroSpork accepts only an update that has the signature of the AeroSpork release key. A Homebrew
install can also update with brew upgrade --cask aerospork.
The update check is the only network request that AeroSpork makes. The privacy page lists what the request sends and what AeroSpork stores on your Mac.
2. Part 2. How to
2.1. Switch from AeroSpace
AeroSpork reads ~/.aerospork.toml or ~/.config/aerospork/aerospork.toml. It never reads
AeroSpace’s ~/.aerospace.toml or ~/.config/aerospace/aerospace.toml. With only an AeroSpace file
present, AeroSpork runs its default config, and Settings offers to import the AeroSpace file.
-
Open Settings from the menu bar icon, and click Import config in the banner at the top. AeroSpork copies your AeroSpace config to
~/.aerospork.tomland loads it. The AeroSpace file stays as it is. The import:-
renames every
AEROSPACE_*environment variable toAEROSPORK_*:AEROSPORK_FOCUSED_WORKSPACE,AEROSPORK_PREV_WORKSPACE,AEROSPORK_WINDOW_IDandAEROSPORK_WORKSPACE. AeroSpork never sets theAEROSPACE_*names. -
changes every call of the
aerospaceCLI toaerospork. Comment lines stay as they are.To do the same by hand, copy the file and make the two renames. AeroSpork loads a line that still says
AEROSPACE_or runsaerospace, and writes a warning that names the line.
-
-
In
[[on-window-detected]], writeifas a table (if.app-id = '…'). AeroSpork rejects AeroSpace’s string form,if = 'test %{…}', with an error that names the replacement. Spellif.during-aerospace-startupasif.during-aerospork-startup. -
Save the file. AeroSpork loads it at once.
What carries over:
-
swap trades the focused window with another.
-
subscribe prints a line of JSON for each event, for a status bar. Its event names and fields are those that its page lists, so check a script against it. See Build a status bar.
-
AeroSpork runs
on-mode-changed, and setsAEROSPORK_MODEandAEROSPORK_PREV_MODEfor its commands. See on-mode-changed. -
persistent-workspacesworks as it does in AeroSpace, and so doesworkspaces. See Which workspaces exist.
What AeroSpork adds:
-
Sticky windows, which stay on screen on every workspace of their monitor.
-
The scratchpad, for a window that you call up on any workspace.
-
A window rule can also run
fullscreen on,sticky on,move-node-to-monitorandmove-node-to-scratchpad. A rule can run only the commands that What a rule can run lists. -
Pins by monitor UUID, which tell two identical monitors apart. See Pin a workspace to a monitor.
-
Windows keep their workspace, their monitor and their place in the tree across a restart of AeroSpork. See What a restart keeps.
What AeroSpork does not have:
-
focus-follows-mouse. AeroSpork reports the key and ignores it. So doconfig-versionandauto-reload-config, and AeroSpork does not reject the file for them. A saved config always reloads by itself. -
A swipe app written for AeroSpace. Such an app connects to the AeroSpace socket, so it never reaches AeroSpork. Bind the gestures to the CLI instead, as the goodies page shows.
-
The shell-like commands of AeroSpace, such as
echo,eval,testandtrue. Run a shell command with exec-and-forget instead.
The first time AeroSpork starts with a config in the v1 spelling (bindings under
[mode.main.binding]), it rewrites the file in the v2 spelling and keeps the original as
<name>.pre-v2. An import does the same. The comments survive only in the .pre-v2 copy. See
v1 and v2 spellings.
2.2. Change the modifier and the workspaces
mod and workspaces generate most bindings: the focus and move keys from mod, and two keys for
each workspace. What mod and workspaces generate lists them.
To change them in the Settings window:
-
Open the Settings window, and select the Keys pane.
-
Select the
mainmode. The bar above the list of bindings shows "Generate with" and "Workspaces". -
Pick a modifier in "Generate with". "Nothing" removes
mod, and then AeroSpork generates no bindings, so every binding is one that you write. -
Click Edit… next to Workspaces. Type a name, such as
dev, or a range, such as1-9, in each row. Click "Add workspace" for another row. -
To give a workspace a key other than the first character of its name, type the key in the field next to the name. A range takes no key.
The list of bindings follows each change at once. A problem, such as two workspaces with the same key, shows in red under the bar.
To change them in the config:
mod = 'ctrl-alt'
workspaces = ['1-5', 'dev', { name = 'docs', key = 'o' }] # docs gets ctrl-alt-o
2.3. Pin a workspace to a monitor
A pin keeps a workspace on one monitor. With the built-in default
auto-move-workspaces-on-monitor-connect = true, AeroSpork moves a pinned workspace back to its
monitor when the monitor connects, so a dock restores your arrangement.
Pin by UUID. The UUID identifies one physical monitor, and it is the only value that separates two monitors of the same model. A DisplayLink monitor reports no vendor, model or serial number, so its UUID is the only value that identifies it.
To pin a workspace in the Settings window:
-
Connect the monitor, or the dock.
-
Open the Settings window, and select the Monitors pane.
-
Under "Connected monitors", find the monitor, and click "Pin a workspace here".
-
Select the workspace. The pane pins it by UUID when the monitor reports one, and by name otherwise.
To pin a workspace in the config:
-
Connect the monitor, or the dock.
-
List the monitors and their fingerprints:
aerospork list-monitors --format '%{monitor-id} %{monitor-name} %{monitor-fingerprint}'The output has one line for each monitor. For example, the built-in monitor and two DisplayLink monitors:
1 Built-in Retina Display { vendor_id = "0x0610", model_id = "0xA050", display_name = "Built-in Retina Display", width_pixels = 1512, height_pixels = 982, uuid = "37D8832A-2D66-02CA-B9F7-8F30A301B230" } 2 DisplayLink 1 { display_name = "DisplayLink 1", width_pixels = 2560, height_pixels = 1440, uuid = "9C1E4F0B-6A2D-4E8A-9B1C-2F3D4E5F6A7B" } 3 DisplayLink 2 { display_name = "DisplayLink 2", width_pixels = 2560, height_pixels = 1440, uuid = "1A2B3C4D-5E6F-4A8B-9C0D-1E2F3A4B5C6D" }The two DisplayLink monitors have the same size and no vendor or model. Only the UUIDs differ.
-
Copy the
uuidvalue of each monitor that you want to pin. -
Add a line to
[monitors]for each workspace. The key is the workspace, and the value is the monitor:[monitors] 1 = 'main' 2 = { uuid = '9C1E4F0B-6A2D-4E8A-9B1C-2F3D4E5F6A7B' } 3 = { uuid = '1A2B3C4D-5E6F-4A8B-9C0D-1E2F3A4B5C6D' } -
Save the file.
-
Check that each workspace is on its monitor:
aerospork list-workspaces --all --format '%{workspace} %{monitor-name}' -
Disconnect the dock, and connect it again. Run the command in the previous step again. The pinned workspaces are back on their monitors.
If parts of off-screen windows show on a monitor after this, see Arrange monitors so off-screen windows stay off screen.
Monitor patterns lists the other patterns: main, position, name and the other
fingerprint fields.
2.4. Send an app to a workspace, or float it
A window rule runs when a window of an app appears. To send an app to a workspace, or to float its
windows, add a line to [on-window]. The key is the bundle ID of the app:
[on-window]
'com.apple.mail' = 'move-node-to-workspace 3'
'com.apple.systempreferences' = 'layout floating'
To find the bundle ID of an app, do one of these:
-
Run
aerospork list-appswhile the app runs. -
Look in the table of popular apps.
-
Run
mdls -name kMDItemCFBundleIdentifier -r /Applications/App.app.
To do the same in the Settings window:
-
Open the Settings window, and select the Window Rules pane.
-
Click the add button below the list.
-
Click "Choose app…", and select the app.
-
Set what the rule does: Float or Tile, fullscreen, sticky, and the workspace, monitor or scratchpad to move the window to.
To match by app name, window title or workspace, see Window rules.
2.5. Put apps back after a logout or a restart of the Mac
A restart of AeroSpork keeps every window where it was. A logout or a restart of the Mac does not: macOS gives each window a new ID, so AeroSpork no longer knows it and places it by where it is on the screen. See What a restart keeps. Write down where your apps belong, and AeroSpork puts them there after each login:
-
Make AeroSpork start at login: in the General pane of the Settings window, turn on "Start AeroSpork at login", or set
start-at-login = true. -
Pin each workspace that belongs on a monitor, so that the workspace goes back to it. See Pin a workspace to a monitor.
-
Write a window rule for each app that has a home:
[on-window] 'com.apple.mail' = 'move-node-to-workspace 3' 'com.tinyspeck.slackmacgap' = 'move-node-to-workspace 4' 'com.apple.Music' = 'move-node-to-monitor secondary'
These rules run on each window that AeroSpork does not know yet: after a login, the windows that are open when AeroSpork starts, and each window that an app opens later. On a restart of AeroSpork alone they do not run again, so a window that you moved by hand stays where you put it.
For a rule that you want only at login, and not for a window that you open later, add
if.during-aerospork-startup = true. In the Window Rules pane, set "Startup timing" to Startup. Such
a rule runs only on the windows that are open when AeroSpork starts, and it runs on each start, so
it also moves a window that AeroSpork remembers:
[[on-window-detected]]
if.app-id = 'com.google.Chrome'
if.during-aerospork-startup = true
run = 'move-node-to-workspace 2'
A rule puts a window on a workspace or a monitor. The split sizes and the order of the tiles from before the logout do not come back.
2.6. Keep a window on every workspace
A window belongs to one workspace, so a video call or a picture-in-picture video goes off screen when you switch away from its workspace. A sticky window follows the workspace that its monitor shows: on each switch it moves to the new workspace, and stays where it is on the screen.
To make the focused window sticky, run sticky. The default config binds it
to alt-shift-s. In a config of your own, bind it to a key:
[keys]
alt-shift-s = 'sticky' # Toggles
To make the windows of an app sticky when they open, write a window rule that says sticky on. This
rule matches the picture-in-picture windows of Chrome and Firefox by their title:
[[on-window-detected]]
if.window-title-regex-substring = '^picture.in.picture$'
run = 'sticky on'
In the Settings window, add the rule in the Window Rules pane: type the title in "Window title", and turn on "Sticky: on every workspace its monitor shows".
A sticky window is a floating window. Tile it, or move it with move-node-to-workspace or
move-node-to-monitor, and it stops being sticky. A minimized sticky window, or one of a hidden app,
stays on its workspace until it comes back.
2.7. Keep a window out of sight, and call it up on any workspace
The scratchpad holds windows that you want close at hand but not on screen: a terminal, a notes app,
a music player. A window in the scratchpad is on no workspace, and AeroSpork keeps it off screen. Run
move-node-to-scratchpad to put the focused window there,
and scratchpad to call it up on the workspace you are on. The window
floats, centred on the monitor. Run scratchpad again to put it away. The default config binds the
two commands to these keys. In a config of your own, add them:
[keys]
alt-shift-minus = 'move-node-to-scratchpad'
alt-backtick = 'scratchpad' # Shows the window you put away last, or puts the focused one back
With --app-bundle-id, a binding calls up the windows of one app. Together with a window rule that
puts the app’s windows in the scratchpad when they open, that makes a dropdown terminal:
[keys]
alt-shift-backtick = 'scratchpad --app-bundle-id com.apple.Terminal'
[[on-window-detected]]
if.app-id = 'com.apple.Terminal'
run = 'move-node-to-scratchpad'
To make the same dropdown terminal in the Settings window:
-
In the Window Rules pane, add a rule, click "Choose app…", select Terminal, and turn on "Or put it in the scratchpad".
-
In the Keys pane, record
alt-shift-backtickin the shortcut field at the bottom, typescratchpad --app-bundle-id com.apple.Terminalas the command, and click Add.
Switching to the app of a window in the scratchpad, for example with cmd-tab, also calls the window up,
so the keyboard never types into a window you cannot see. A window that a rule puts away as it opens
stays away, and the keyboard goes back to the window you were using. When AeroSpork quits, or you
turn it off with enable off, the windows in the scratchpad come back centred on the main monitor.
A window that you called up stays on that workspace, like any floating window, until you put it back.
Move it with move-node-to-workspace or move-node-to-monitor, tile it, or make it sticky, and it
stops being a scratchpad window. list-windows and list-workspaces do not show the windows in the
scratchpad, as they do not show minimized windows. list-windows --scratchpad lists them, and
%{window-is-scratchpad} tells a scratchpad window you called up from the others.
2.8. Move and resize tiles with the mouse
AeroSpork follows a drag of the focused window and changes the tree to match. You need no setting for this.
-
Swap two tiles. Drag a tiled window by its title bar. When the pointer enters another tile, the two windows trade places. Release the button, and the window snaps into its new tile. In an accordion, the dragged window trades places with the window that the accordion shows.
-
Move a tile to another monitor. Drag the window onto another monitor, and release it there. It joins the workspace that the monitor shows, before or after the tile under the pointer, by the half of the tile that the pointer is in.
-
Resize tiles. Drag an edge of a tiled window. The windows on that side give up or take the space, and the split keeps the new sizes. This works in a
tilescontainer, not in an accordion. -
Move a floating window to another monitor. Drag it there. It joins the workspace of the monitor that its center is on.
A drag does nothing to a window on a workspace that is not on screen, or to a minimized, fullscreen or hidden window. To drag a window by any part of it, not only the title bar, see the goodies page. The keyboard does the same with swap, move and resize.
2.9. Add a binding mode
A binding mode is a named set of bindings. When you switch to a binding mode, AeroSpork disables the
bindings of the current mode and enables the bindings of the new one. AeroSpork starts in the mode
named main. The feature is the same as the one in i3.
A mode needs a binding that enters it, and a binding that leaves it. To add a resize mode in the
Settings window:
-
Open the Settings window, and select the Keys pane.
-
Click the "…" menu next to the mode picker, click "New mode…", type
resize, and click Add. The pane selects the new mode. It saves the mode when the mode has its first binding. -
Click the shortcut field at the bottom, and press
-. Typeresize smart -50as the command, and click Add. Add=withresize smart +50the same way. -
Add
escwithmode main, the way back. -
Select
main, and addalt-rwithmode resize, the way in.
[keys] holds the bindings of main, and [keys.<mode>] holds the bindings of another mode. The
same mode in the config:
[keys]
alt-r = 'mode resize' # A binding in 'main' that enters 'resize'
[keys.resize] # The 'resize' binding mode
minus = 'resize smart -50'
equal = 'resize smart +50'
esc = 'mode main' # A way back to 'main'
The default config has one more example, the service mode on alt-shift-semicolon.
2.10. Use a non-QWERTY keyboard layout
AeroSpork reads the keys in your bindings as the QWERTY layout. For Dvorak or Colemak, select the preset:
[key-mapping]
preset = 'dvorak' # or 'colemak'
For another layout or alphabet, or for an alias of a key, map a name to a QWERTY key:
[key-mapping.key-notation-to-key-code]
unicorn = 'u'
[keys]
alt-unicorn = 'workspace wonderland'
2.11. Run a script when focus changes
An event callback runs commands when the focus or the binding mode changes. To make the mouse follow the focused monitor in the Settings window:
-
Open the Settings window, and select the Events pane.
-
Under "Focused monitor changed", click "Add command", and type
move-mouse monitor-lazy-center.
The pane has a section for each callback: "After startup", "Focused workspace changed", "Focused monitor changed", "Focus changed" and "Binding mode changed". A section runs its commands in order, top to bottom. The same callbacks in the config:
# The mouse follows the focused monitor (the default in i3)
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
# Or: the mouse follows every focus change, of a window or of a workspace
# on-focus-changed = ['move-mouse window-lazy-center']
To run a shell command, use exec-and-forget. A command that on-focused-workspace-changed runs gets
AEROSPORK_FOCUSED_WORKSPACE and AEROSPORK_PREV_WORKSPACE, and one that on-mode-changed runs
gets AEROSPORK_MODE and AEROSPORK_PREV_MODE:
# Keep a log of the workspaces you switch to
on-focused-workspace-changed = ['exec-and-forget echo "$AEROSPORK_FOCUSED_WORKSPACE" >> ~/workspace-history.log']
Each callback starts a process for each event. A status bar that redraws on every change does
better with one long-lived aerospork subscribe. See Build a status bar. Event callbacks describes
each callback.
2.12. Build a status bar
A status bar shows the workspaces, which one has the focus, and often the binding mode. Read that
state from one long-lived aerospork subscribe. A bar that runs
list-workspaces on a timer, or from a callback, starts a process for each redraw and is still late.
-
Start the stream with the events that the bar draws:
aerospork subscribe focused-workspace-changed workspace-windows-changed mode-changed -
Draw the whole bar from the first line,
snapshot. It holds the mode, the focused workspace, window and monitor, each monitor with the workspace it shows, and each workspace with its windows. -
Apply each line after it to what you drew. Each line is one JSON object. Check that its
versionis1, and skip an event or a field that you do not know: AeroSpork can add either without a new version. -
When the stream ends, start it again, and draw again from the new snapshot. The stream ends when AeroSpork quits or restarts, when
aerospork enable offturns window management off, and when the bar stops reading, because AeroSpork drops a reader that falls behind.
The events, and what a bar does with each:
| Event | Use it to |
|---|---|
|
Move the highlight to the workspace you switched to. |
|
Show which workspaces are empty, or the apps on each one. |
|
Show the focused window. |
|
Mark the monitor that has the focus. |
|
Show the binding mode, for example while |
|
React to a new window, after the window rules placed it. |
|
Redraw a layout or sticky indicator: a window was tiled or floated, made sticky or not, or its container changed layout or orientation. |
The subscribe page lists the fields of each event.
For a value that no event carries, run one query when an event says that it changed, not on a timer. These format variables are for status bars and scripts:
-
%{window-x},%{window-y},%{window-width}and%{window-height}: the frame of a window, in points. They are empty for a window that is not on screen. -
%{window-is-scratchpad}: true for a window in the scratchpad, put away or called up.aerospork list-windows --scratchpadlists those windows. A window that is put away is on no workspace, so no other listing shows it. -
%{monitor-uuid}: the UUID of a monitor. It stays the same across restarts and docks.%{monitor-id}, and themonitor-idof the events, number the monitors from left to right, so they change when you rearrange them.
For example, aerospork list-windows --focused --format '%{window-layout} %{window-is-sticky}'
prints the layout of the focused window, and aerospork list-windows --scratchpad --format
'%{app-name}' the apps in the scratchpad.
A value can come from an app, such as a window title. --format prints each control character in
it as � (U+FFFD), so a title cannot add a line to the output that a script reads. --json
escapes the characters instead.
The CLI reaches AeroSpork through a socket in the temporary folder of your account,
$(getconf DARWIN_USER_TEMP_DIR)com.wbs.aerospork.sock, which no other account can write.
AeroSpork still listens on the old path, /tmp/com.wbs.aerospork-<user>.sock, for scripts that
name it. What goes over the socket is not a stable interface, so read the events through the CLI.
The goodies page has a complete
SketchyBar recipe on subscribe.
2.13. Arrange monitors so off-screen windows stay off screen
AeroSpork moves the windows of a workspace that is not visible past an edge of their monitor. It tries the bottom right corner, the bottom left corner, then the right edge and the left edge. If no other monitor touches one of those places, the windows stay out of sight.
-
Open System Settings > Displays > Arrange.
-
Arrange the monitors so that each monitor has free space next to one bottom corner or one side edge. Monitors stacked one above the other are fine if one side of each is free.
If a monitor has no free space on any side, parts of its off-screen windows show on the other monitors. The Monitors pane of the Settings window warns about such a monitor, names it, and has a button that opens System Settings > Displays. The warning goes away when the arrangement leaves a free corner or side.
To make the 1-pixel edges less visible, put the Dock at the bottom of the screen, and enable "Automatically hide and show the Dock" in System Settings > Desktop & Dock.
3. Part 3. How AeroSpork works
3.1. Terms
This guide uses one term for each thing:
- window
-
A macOS window that AeroSpork manages. A window is a leaf of the tree.
- container
-
A node of the tree that holds windows or other containers. It has a layout and an orientation.
- node
-
A window or a container.
- layout
-
How a container shows its children:
tilesside by side, oraccordionon top of each other. - tiling, floating
-
The state of a window. A tiling window is part of the tree. A floating window is not.
- workspace
-
A set of windows that AeroSpork shows or moves off screen together. It replaces a macOS Space.
- visible workspace
-
The workspace that a monitor shows. Each monitor has one.
- focused workspace
-
The visible workspace that has the focus. There is one.
- off screen
-
The place of the windows of a workspace that is not visible: past an edge of the monitor. Compare with hidden.
- hidden
-
The state of an app that macOS hides, with
cmd-hfor example. - monitor
-
A physical display. "Display" appears only in names that macOS uses, such as "Displays have separate Spaces".
- main monitor
-
The monitor that macOS uses for the menu bar (System Settings > Displays > Use as).
- pin
-
A line in
[monitors]that keeps a workspace on one monitor. - binding
-
A key and the command that it runs.
- binding mode, mode
-
A named set of bindings. AeroSpork starts in
main. - window rule
-
A rule that runs when a window appears: a line of
[on-window], or a[[on-window-detected]]table. - event callback
-
Commands that run when the focus changes, such as
on-focus-changed. - config
-
The TOML file that AeroSpork reads.
- default config
-
The config file that ships inside the app. AeroSpork uses it when you have no config.
- built-in default
-
The value of a key that your config leaves out.
- v1 spelling, v2 spelling
-
Two ways to write the same config. See v1 and v2 spellings.
- Settings window, pane
-
The window that edits the config, and one of its seven sections.
- bundle ID
-
The identifier of an app, such as
com.apple.mail.if.app-idmatches it.
3.2. The tree
AeroSpork keeps all windows and containers of a workspace in a tree. The model comes from i3.
-
Each workspace has one root container.
-
A container can hold any number of child nodes.
-
A window is always a leaf. A window has no children.
-
Each container has a layout (
tilesoraccordion) and an orientation (horizontalorvertical).
The layout of a window means the layout of its parent container.
|
Note
|
i3 uses different terms. A "container" in i3 is a "node" in AeroSpork. |
Containers can nest to any depth. The focus command moves the focus in four directions: left, down, up and right.
Three commands change the tree:
-
split, for i3 compatibility. While
enable-normalization-flatten-containersis on (the built-in default),splitworks only on a workspace that holds one window, where it sets the direction the next window opens in. Next to other windows it fails, because normalization removes the container that it would make. Usejoin-withthere.
3.2.1. Layouts
AeroSpork has four layouts:
-
h_tiles, horizontal tiles. i3 calls it "horizontal split". -
v_tiles, vertical tiles. i3 calls it "vertical split". -
h_accordion, horizontal accordion. It is like the "tabbed" layout of i3. -
v_accordion, vertical accordion. It is like the "stacked" layout of i3.
The tree section shows the tiles layout.
In an accordion layout, the windows are on top of each other. The horizontal accordion shows
padding on the left and the right to show that other windows are in those directions. The vertical
accordion shows padding at the top and the bottom. accordion-padding sets the size of the
padding.
As in a tiles layout, the focus command moves through an accordion:
focus left and focus right in an h_accordion, focus up and focus down in a v_accordion.
3.2.2. Normalization
By default, AeroSpork applies two normalizations to the tree:
-
A container that has only one child is flattened. The root container is an exception: it can have a single window as its child.
enable-normalization-flatten-containerscontrols this. -
Containers that nest in each other have opposite orientations.
enable-normalization-opposite-orientation-for-nested-containerscontrols this.
Example 1
The first normalization does not permit this tree:
h_tiles (root node)
└── v_tiles
└── window 1
AeroSpork changes it at once to:
v_tiles (new root node) └── window 1
Example 2
The second normalization does not permit this tree:
h_tiles
├── window 1
└── h_tiles
├── window 2
└── window 3
AeroSpork changes it at once to:
h_tiles
├── window 1
└── v_tiles
├── window 2
└── window 3
With the normalizations, you can read the tree from the positions of the windows on the screen. Keep them enabled unless you have a specific reason. To disable them:
enable-normalization-flatten-containers = false
enable-normalization-opposite-orientation-for-nested-containers = false
3.2.3. Where a new window goes
A new window opens beside the focused window, in the same container. Each new window takes a share of that whole row, so a third or fourth window makes every window in the row narrower.
To make a new window share the focused window’s tile instead, set:
new-window-placement = 'nest' # the built-in default is 'sibling'
With 'nest', the focused window and the new window go into a new container that takes the
focused window’s place and size. The other windows keep their size. With the normalizations on, the
new container has the opposite orientation of its parent, so windows open in a spiral:
h_tiles
├── window 1
└── v_tiles
├── window 2
└── h_tiles
├── window 3
└── window 4
With enable-normalization-opposite-orientation-for-nested-containers = false, the new container
splits the focused window along its longer side.
Some windows never nest:
-
The first two windows of a container. They sit side by side, because the focused window already fills its container.
-
A window in an accordion container.
-
A window that a restart brings back to the place it had, and the windows that are already open when AeroSpork starts.
-
A new native tab. It takes the tile of its tab group.
-
A window that comes back from minimized, hidden or fullscreen. It goes back to its place.
-
A window that
layout tilingor a move command puts in the tiles.
When a window rule moves a new window to another workspace, the window nests there, beside the focused window of that workspace. The Layout section of the General pane in Settings has the same choice.
3.2.4. Floating windows
A floating window is not part of the tree, with one exception: the focus command treats it as part of the tree. The parent container of a floating window is the smallest tiling container whose area contains the center of the floating window. Thus, you do not need a separate binding to focus floating windows.
3.2.5. Commands
Commands change AeroSpork and query its state. You can use a command in two ways:
-
Bind it to a key in the config:
[keys] # Bind alt-f to one command alt-f = 'fullscreen' # Or bind a sequence of commands: move the window to workspace 1, then follow it alt-ctrl-1 = ['move-node-to-workspace 1', 'workspace 1'] -
Run it from the CLI:
aerospork workspace 1
The command reference lists every command.
3.3. Workspaces instead of Spaces
AeroSpork does not use macOS Spaces. It shows the windows of the visible workspace, and moves the windows of every other workspace off screen. macOS Spaces have several limits that AeroSpork avoids:
-
Each switch between Spaces is animated. The animation cannot be disabled. "Reduce motion" only makes it shorter.
-
The number of Spaces is limited: 16 with one monitor.
-
A shortcut can only switch between Spaces. It cannot create, delete or reorder a Space, or move a window to another Space.
-
Apple provides no public API for any of those operations.
The windows of a workspace that is not visible sit past the bottom right or bottom left corner of
their monitor. When neither corner of a monitor is free, they sit past its right or left edge. macOS
does not let a window go fully off screen, so a 1-pixel edge of each off-screen window stays
visible. When you switch to the workspace, with the workspace command
or cmd-tab, AeroSpork brings its windows back.
Keep a single macOS Space, or one Space for each monitor if "Displays have separate Spaces" is on, and use workspaces instead of Spaces. The menu bar icon shows the visible workspace of each monitor, and marks the focused one.
When you quit AeroSpork, it brings every window back on screen. A tiled window is centered on the
monitor of its workspace. A floating window goes back to the spot where you put it. killall
AeroSpork runs the same cleanup, but if AeroSpork is stuck and the cleanup is not done after 10
seconds, AeroSpork exits without it. A crash does not run the cleanup either. In both cases, windows
can stay off screen. See Windows are stuck off screen.
3.3.1. What a restart keeps
When AeroSpork restarts, it puts back the whole layout:
-
The workspace of each window, and the monitor of each workspace.
-
The workspace that each monitor showed.
-
The tree of each workspace, with its split sizes and layouts.
-
The place of each floating, fullscreen and minimized window, which windows are sticky, and which are in the scratchpad.
AeroSpork knows a window by the ID that the macOS window server gives it. The memory lasts as long
as the window server does. A restart of AeroSpork keeps it: an update, a crash, killall, or Quit
from the menu bar. A logout, a restart of the Mac, or a quit and relaunch of an app do not keep
it, because macOS then gives the windows new IDs. AeroSpork does not guess. It places such a window
by where the window is on the screen.
To send the windows of an app to a specific place after the app restarts, or after a logout, write a
window rule. Put apps back after a logout or a restart of the Mac has the steps. A window
rule does not run again on a window that AeroSpork remembers, unless the rule has
if.during-aerospork-startup = true.
AeroSpork keeps this memory in ~/Library/Caches/com.wbs.aerospork/workspace-memory.json, which
only your user account can read. If you delete the file, you lose one restart’s worth of placement
and nothing else.
3.4. Multiple monitors
All monitors share one pool of workspaces:
-
Each monitor shows its own workspace, the visible workspace of that monitor.
-
Two monitors cannot show the same workspace at the same time.
-
Each workspace has a monitor, even while it is empty or not visible.
-
By default, a workspace belongs to the main monitor.
When you switch to a workspace, AeroSpork shows the workspace on its monitor, and focuses it. To move a workspace to another monitor, use move-workspace-to-monitor. To keep a workspace on one monitor, pin it.
The shared pool rests on an observation: most users keep only a few workspaces on their other monitors. Those monitors usually have one task, such as a browser, a shell, or logs and dashboards. So one workspace for each other monitor, and the rest on the main monitor, is a common fit.
|
Note
|
AeroSpork and i3 differ in one place: a switch to an empty workspace. AeroSpork shows an empty
workspace on its own monitor. i3 shows it on the focused monitor. The AeroSpork model fits
the observation, and it treats empty and non-empty workspaces the same way. To get
the i3 behaviour, set open-empty-workspaces-on-focused-monitor = true. Then workspace,
workspace-back-and-forth and the menu bar show an empty workspace that is not on screen on the
focused monitor. A pinned workspace still goes to its own monitor.
|
3.5. macOS features that interact with AeroSpork
3.5.1. Hidden, minimized and fullscreen windows
macOS can take a window out of the tiles: when you hide its app (cmd-h, or cmd-alt-h for "Hide
Others"), when you minimize it, and when you put it in native fullscreen. AeroSpork keeps the place
of such a window. When the window comes back, it goes back to its place in the tree, at its share
of the split. The other windows grow to fill the space while it is away.
To stop cmd-h from making windows disappear, set:
automatically-unhide-macos-hidden-apps = true
With true, AeroSpork shows every hidden app again at once, and focuses the app that you hid with
cmd-h, so the shortcut does nothing. Only workspaces then make windows disappear. "Hide Others" is
undone too, but AeroSpork does not change the focus for it. The built-in default is false.
A window with native tabs takes one tile, however many tabs it has. The tile follows the selected tab.
3.5.2. Mission Control
With many off-screen windows in the bottom corners, Mission Control draws all windows smaller than it needs to. To fix this, enable "Group windows by application":
defaults write com.apple.dock expose-group-apps -bool true && killall Dock
Or enable it in System Settings > Desktop & Dock > Group windows by application.
3.5.3. Displays have separate Spaces
Disable "Displays have separate Spaces", unless you need native fullscreen on more than one monitor. macOS enables it by default. With it enabled, users report these problems:
-
The wrong window can get the focus with several monitors. This is a bug in an Apple API.
-
The wrong borderless Alacritty window can get the focus, even with one monitor. This is a bug in an Apple API.
-
Performance problems.
-
macOS can move the focus back on its own.
With the setting enabled, a move to another monitor is also a move to another Space. The public APIs that AeroSpork uses do not know about Spaces, so they do not handle that move correctly.
| "Displays have separate Spaces" enabled | "Displays have separate Spaces" disabled | |
|---|---|---|
Can a window span several monitors? |
No. This is a macOS limit. |
Yes |
Stability and performance |
Focus and performance problems can occur (see the list above) |
The public Apple APIs are more stable, and so is AeroSpork |
When the first monitor shows an app in native fullscreen |
The second monitor works independently |
The second monitor is black and unusable |
The macOS menu bar |
Shows on each monitor |
Shows only on the main monitor |
Native fullscreen creates a Space of its own, which brings back the problems above.
To disable the setting, run this command, then log out and log in again:
defaults write com.apple.spaces spans-displays -bool true && killall SystemUIServer
Or disable it in System Settings > Desktop & Dock > Displays have separate Spaces.
With more than one monitor, the Monitors pane of the Settings window warns while the setting is on, and has a button that opens Desktop & Dock.
3.5.4. Dialogs
AeroSpork floats every window that it identifies as a dialog. Apple provides an Accessibility API that lets an app say which of its windows are dialogs. Many apps do not implement this API, or implement it incorrectly. Even some Apple windows do not: for example, the Finder copy-progress window does not report that it is a dialog.
So AeroSpork also applies its own rules. For example, AeroSpork treats a window without a fullscreen button as a dialog, except in terminal apps such as WezTerm, Alacritty and iTerm2. The fullscreen button and the maximize button are different buttons.
If AeroSpork floats or tiles the windows of an app the wrong way, open an issue at https://github.com/wbsmolen/aerospork/issues. Until a fix ships, a window rule can force tiling or floating for all windows of the app:
[on-window]
'com.example.tiles' = 'layout tiling' # Force tiling
'com.example.floats' = 'layout floating' # Force floating
4. Part 4. Troubleshooting and bug reports
4.1. A binding does nothing
-
Open the Settings window, and select the Keys pane. A shortcut that another app owns has a warning mark, and a line under the list counts them. The same fact is in the
configlog, as a recordHotkey <key> not registered(see Capture logs):log show --last 1h --predicate 'subsystem == "com.wbs.aerospork" AND category == "config"' --style compactThe mark and the record mean that another app owns the key.
-
Quit or reconfigure the other app. Software that listens to global keys, such as skhd, Karabiner-Elements and Raycast, is the usual cause.
-
If there is no mark and no record, check that your config loaded. See Is my config the problem?.
4.2. Is my config the problem?
aerospork config --config-path # which file is loaded now
aerospork reload-config --dry-run # parse the config, and do not apply it
Run --config-path first:
-
A path inside the app (
…/AeroSpork.app/Contents/Resources/default-config.toml) means that AeroSpork runs the default config. You have no config, or yours failed to load at startup. -
Your own path means that your config loaded. If an edit then does nothing, the edited file did not parse, and AeroSpork kept the config that it had before.
In both cases, reload-config --dry-run tells you why.
4.3. Windows are stuck off screen
If AeroSpork crashes, or you stop it while it does not respond, windows can stay off screen.
-
Start AeroSpork again. It brings back every window that it manages.
-
If AeroSpork does not start, look at the bottom corners and the side edges of each monitor. A 1-pixel edge of each off-screen window stays there.
-
Drag that edge to the center of the screen.
If parts of off-screen windows show on another monitor while AeroSpork runs, see Arrange monitors so off-screen windows stay off screen.
4.4. An app does not respond
A hung or very busy app that does not answer Accessibility requests keeps its windows where they are. AeroSpork does not treat them as closed, and does not move the focus away from them. Until the app recovers, each layout pass can wait up to a second for it, so workspace switches can feel slower.
4.5. "AeroSpork is already running"
Only one copy of AeroSpork runs at a time. If you start another copy, for example the binary from a
terminal while the login item runs, that copy prints
AeroSpork is already running (pid N), so this copy is exiting and exits. To restart AeroSpork,
quit the running copy first.
4.6. Capture logs
AeroSpork always writes the important events to the macOS unified log. You do not need to enable anything. The records cover which version started, which config loaded or why it did not, config warnings, bindings that did not register, focus that AeroSpork moved on its own, the CLI socket, and every CLI command that exited non-zero.
To collect the log for a bug report:
-
Reproduce the problem, or note the time when it happened.
-
Within the hour, save the log of the last hour to a file:
log show --last 1h --predicate 'subsystem == "com.wbs.aerospork"' --style compact > aerospork.log -
If AeroSpork showed an internal error, find its report in
~/Library/Logs/com.wbs.aerospork/. AeroSpork writes a report there for each internal error, and never sends it anywhere.
To watch the log live instead, run
log stream --predicate 'subsystem == "com.wbs.aerospork"' --style compact.
Each record has a category. To narrow the log, add the category to the predicate, as in A binding does nothing:
config-
The startup record (the version, and whether verbose tracing is on), the config that loaded or that AeroSpork rejected, config warnings, hot-reload problems,
Hotkey <key> not registered, an AeroSpace config found where no AeroSpork config exists, and a Settings change that AeroSpork could not save when its window closed. server-
The CLI socket, a second copy that exits because one already runs, and every CLI command that exited non-zero.
session-
Focus that AeroSpork moved on its own: a window that closed under the focused one, focus taken back from macOS, a restore of the window cache, and focus that followed macOS onto a workspace that was not on screen (an app that activated itself, or the next window after a close). Start here for "focus jumped on its own". A focus change that follows a click has no record. The same category also holds refresh failures and quit-cleanup errors.
4.7. Verbose tracing
The records above are sparse on purpose. For a trace of every refresh and every command, turn on
verbose tracing. AeroSpork writes the trace at debug level, which the unified log does not keep: only
a log stream that already runs receives it, and a later log show does not find it.
-
Start the stream, and save it to a file. Do not add a
categoryfilter: the trace is under categoryDebug.log stream --debug --predicate 'subsystem == "com.wbs.aerospork"' > aerospork-trace.log -
In another terminal, turn tracing on. It starts at once, with no restart:
aerospork debug-log on -
Reproduce the problem.
-
Turn tracing off, then stop the stream with Control-C. Tracing also stops when AeroSpork quits.
aerospork debug-log off
Each switch writes Verbose tracing: on or Verbose tracing: off to the config category, so a
later log show can tell whether the trace was on.
For a problem during startup, trace from launch instead. Set the variable, and restart AeroSpork.
The loop waits for the old copy to exit, because open otherwise wakes the old copy, which does not
have the variable. The startup record then ends in verbose tracing: on:
launchctl setenv AEROSPORK_DEBUG_LOG 1
killall AeroSpork; while pgrep -qx AeroSpork; do sleep 0.2; done; open -a AeroSpork
When you finish, run launchctl unsetenv AEROSPORK_DEBUG_LOG, so the next launch does not trace.
These commands are for a release build. A debug build has a different bundle ID, process name and app path. Its commands are in the development guide, under "Read a debug build’s logs".
4.8. What to include in a bug report
Open an issue at https://github.com/wbsmolen/aerospork/issues/new?template=bug_report.md and attach:
-
The output of
aerospork --version. It prints the CLI version and the app version. If the two are different, say so. -
The output of
aerospork config --config-path, and the config file itself. -
The log from Capture logs, and the trace from Verbose tracing for a layout or focus problem.
-
The report from
~/Library/Logs/com.wbs.aerospork/, if AeroSpork showed an internal error. -
For a layout or focus problem, the state of AeroSpork right after it went wrong:
aerospork debug-windows --tree > tree.jsonIt holds each monitor and the workspace it shows, the tree of each workspace, each app, and the inconsistencies that AeroSpork found. It reads only AeroSpork’s own state, so it answers even while an app does not.
-
For a window that floats when it should tile, or the other way round, a recording of what macOS reports about it. Run
aerospork debug-windows, focus the window or make it appear, and runaerospork debug-windowsagain. See debug-windows. -
For a problem with monitors or docking, the output of
aerospork list-monitors --format '%{monitor-id} %{monitor-name} %{monitor-fingerprint}'. Remove the UUIDs if you do not want to publish them. They identify specific hardware.
5. Part 5. Config reference
The config is TOML, which permits comments. See the TOML spec.
5.1. Where the config lives
AeroSpork reads the first of these files that exists:
-
~/.aerospork.toml -
${XDG_CONFIG_HOME}/aerospork/aerospork.toml. WhenXDG_CONFIG_HOMEis not set, AeroSpork uses~/.config.
If both files exist, AeroSpork reports an error at startup and runs the default config.
A debug build reads ~/.aerospork-debug.toml or ${XDG_CONFIG_HOME}/aerospork/aerospork-debug.toml
instead, so a debug build never touches the config of your installed copy. If you start the app
with --config-path <file>, AeroSpork reads that file, and does not look at the other locations.
5.2. Built-in defaults and the default config
Two different things are called "default":
-
The default config is the file that ships inside the app. AeroSpork uses it only when you have no config. When you have one, AeroSpork does not read the default config at all.
-
A built-in default is the value of a key that your config leaves out.
The two differ where it matters most:
| Key | Built-in default (the key is left out) | The default config |
|---|---|---|
|
|
|
|
not set: AeroSpork generates no bindings |
|
|
not set: no workspace bindings, and no declared workspaces |
|
|
empty |
|
|
empty |
empty (examples in comments) |
The other built-in defaults:
| Key | Built-in default | In the default config |
|---|---|---|
|
|
commented out |
|
|
commented out |
|
|
commented out |
|
|
commented out |
|
|
commented out |
|
|
no |
|
|
no |
|
|
no |
|
|
no |
|
|
no |
|
|
no |
|
|
no |
|
no |
after-startup-command, on-focus-changed, on-focused-workspace-changed,
on-focused-monitor-changed, on-mode-changed, on-window-detected, persistent-workspaces and
workspace-to-monitor-force-assignment are empty by default.
5.3. v1 and v2 spellings
AeroSpork reads two spellings of the config. The default config uses the v2 spelling, and the examples in this guide do too. The v1 spelling is the one AeroSpace uses.
| v2 spelling | v1 spelling |
|---|---|
|
every binding written out |
|
|
|
|
|
|
|
no short form |
|
|
[[on-window-detected]] is the long form of a window rule in both spellings.
A file is v2 when it has one of mod, workspaces, keys, monitors or on-window. Both
spellings parse in either kind of file, so a file that mixes them, by hand or through the Settings
window, still loads. Here is the same binding mode in both spellings:
# v1
[mode.main.binding]
alt-r = 'mode resize'
[mode.resize.binding]
esc = 'mode main'
# v2
[keys]
alt-r = 'mode resize'
[keys.resize]
esc = 'mode main'
5.3.1. How a v1 config becomes v2
The first time AeroSpork starts with a config that has only the v1 spelling, it rewrites the file in
the v2 spelling, and keeps the original next to it as <name>.pre-v2:
-
AeroSpork rewrites the file only when the new file parses to the same configuration. Otherwise it leaves your file exactly as it is.
-
AeroSpork migrates a file only once. If a
.pre-v2file exists, AeroSpork does not migrate again, so a config that you change back to v1 stays v1. -
The rewrite generates a new file. The comments and the formatting of the original survive only in the
.pre-v2copy.
5.3.2. What mod and workspaces generate
mod = 'alt' generates these 13 bindings, with alt in place of mod:
| Binding | Command |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
With mod set, each workspace in workspaces also generates two bindings: mod-<key> switches
to it, and mod-shift-<key> moves the focused window to it. <key> is the first character of the
name, in lower case (dev gives mod-d). workspaces accepts a range, a list, or both:
workspaces = ['1-9', 'A', 'chat']. A token is a range only when it is exactly <char>-<char>, so
my-workspace stays a literal name.
-
[keys]adds to the generated bindings. If a key in[keys]is also generated, your binding wins, so you can replace any generated binding.[mode.*.binding]adds to both. -
Without
mod, AeroSpork generates no bindings, and you bind everything yourself. -
Two workspaces whose names start with the same character (
workspaces = ['dev', 'docs']) are an error, because AeroSpork would generate the same key twice. So is a workspace whose first character is a key thatmodalready uses, such ash. A name whose first character has no key on the keyboard (a non-Latin script, for example) is an error too. Rename the workspace, or give it a key of its own with an entry that names both:workspaces = ['dev', { name = 'docs', key = 'o' }]givesdocsthe bindingsmod-oandmod-shift-o. A range takes no such entry.
aerospork config reads the loaded config. For example,
aerospork config --get mode.main.binding --json prints every binding of main, the generated
ones included.
5.4. Which workspaces exist
A workspace that the config declares always exists, even while it is empty and on no monitor:
-
Every name in
workspaces, with or withoutmod. -
Every name in
persistent-workspaces, a list of names or ranges such aspersistent-workspaces = ["1-9", "chat"]. This key declares workspaces, and generates no bindings. -
Every workspace that a line of
[monitors](orworkspace-to-monitor-force-assignment) pins.
aerospork config --get persistent-workspaces lists every declared workspace. A reserved name that
no command can switch to, such as next, is an error.
aerospork list-workspaces --all, the menu bar and workspace next and workspace prev show every
declared workspace from the moment AeroSpork starts.
AeroSpork creates any other workspace when you first switch to it, and releases it when it is
empty and not visible. An example is a workspace that only a binding of your own names, such as
alt-0 = 'workspace 10'. Such a workspace costs nothing until you use it. An empty workspace is
only its name, so a switch back creates the same workspace again.
A declared workspace that you did not switch to yet belongs to the main monitor. With several
monitors, workspace next and workspace prev cycle through it on the main monitor until you first
switch to it on another monitor. After that, it keeps the monitor where it was last, also across a
restart.
5.5. Key notation
A binding key is zero or more modifiers and one key, joined with -: alt-shift-h. The four
modifiers are shift, ctrl, alt and cmd. The key names are:
-
The letters
atoz, and the digits0to9. -
f1tof20, and the arrowsleft,down,upandright. -
minus,equal,period,comma,slash,backslash,quote,semicolon,backtick,leftSquareBracket,rightSquareBracket,space,enter,esc,backspace,tab,pageUp,pageDown,home,end,forwardDelete, andsectionSign(ISO keyboards). -
The keypad:
keypad0tokeypad9,keypadClear,keypadDecimalMark,keypadDivide,keypadEnter,keypadEqual,keypadMinus,keypadMultiplyandkeypadPlus.
For other keyboard layouts, see Use a non-QWERTY keyboard layout.
5.6. Gaps
[gaps] puts space between windows (inner) and between windows and the monitor edge (outer).
To set the gaps in the Settings window, select the Gaps pane. "Between windows" sets inner, and
"Around the screen" sets outer. Turn off "Same value for both" or "Same on all sides" to set each
direction on its own. The preview at the top follows each change.
The same gaps in the config:
[gaps]
inner = 8 # both axes at once…
outer = 8 # …or per direction:
# inner.horizontal = 8
# inner.vertical = 8
# outer.top = 8
# outer.bottom = 8
# outer.left = 8
# outer.right = 8
Each of the six per-direction values can also differ per monitor. The value is then an array: one
or more { monitor.<pattern> = <gap> } rules, which AeroSpork tries in order, and a plain number as
the last element. AeroSpork uses the number when no rule matches, so the number is required:
[gaps]
outer.top = [{ monitor.'built-in' = 3 }, { monitor.main = 16 }, 24]
<pattern> accepts the same monitor patterns as a pin. The Gaps
pane edits single numbers only. Before an edit replaces per-monitor rules, the pane warns you. Edit
per-monitor rules in the Raw TOML pane.
5.7. Monitor patterns
A line in [monitors] pins a workspace to a monitor. The key is the workspace name, and the value
is a monitor pattern. Pin a workspace to a monitor has the procedure. The v1 spelling of the
section is workspace-to-monitor-force-assignment.
[monitors]
1 = 1 # The monitor at this position from left to right, from 1
2 = 'main' # The main monitor
3 = 'secondary' # The other monitor, when there are exactly two
4 = 'built-in' # A case-insensitive regex substring of the monitor name
5 = '^built-in retina display$' # A case-insensitive regex match of the monitor name
6 = ['secondary', 'dell'] # Several patterns. AeroSpork uses the first that matches
7 = { uuid = 'AAAAAAAA-0000-4000-8000-000000000001' } # A fingerprint (see below)
The monitor patterns are:
-
main: the main monitor ("Use as: Main display" in System Settings > Displays). -
secondary: the monitor that is not the main monitor, when there are exactly two monitors. -
<number>, for example1or2: the position of the monitor from left to right, from 1. -
<regex-pattern>, for exampledell.*orbuilt-in.*: a case-insensitive regex substring of the monitor name. -
{ uuid = … }or another fingerprint: a physical monitor. See Fingerprints. -
An array of patterns. AeroSpork uses the first pattern that matches.
move-workspace-to-monitor fails for a pinned workspace.
5.7.1. Fingerprints
A fingerprint identifies a physical monitor by its hardware, not by its position or name. Use one for a dock, which connects and disconnects monitors often, in changing positions.
To read the fingerprint of each monitor, run:
aerospork list-monitors --format '%{monitor-id} %{monitor-name} %{monitor-fingerprint}'
The fingerprint prints as a table that you can paste into [monitors]. Use only the fields that
you need:
auto-move-workspaces-on-monitor-connect = true # The built-in default
[monitors]
# The exact monitor. It survives a dock, and it is the only field that separates two identical
# monitors.
1 = { uuid = 'AAAAAAAA-0000-4000-8000-000000000001' }
# Vendor and model. Both are numbers: a TOML integer, or a '0x'-prefixed hex string. A bare 'D0C1',
# or a vendor *name* like 'LG', is a parse error, not a failed match.
2 = { vendor_id = '0x10AC', model_id = '0xD0C1' }
# Serial number. Copy the value from `aerospork list-monitors`, not from the label on the back of
# the monitor.
3 = { serial_number = '16843009' }
# Vendor, model and size
4 = { vendor_id = '0x1234', model_id = '0x5678', width_pixels = 3840, height_pixels = 2160 }
# Several patterns, tried in order, with a plain pattern as the fallback
dev = [
{ display_name = 'LG UltraFine' },
'secondary', # The other monitor, when the LG is not connected
]
When auto-move-workspaces-on-monitor-connect is true (the built-in default), AeroSpork moves
each pinned workspace to its monitor when that monitor connects.
The fingerprint fields:
-
uuid: the stable UUID of the monitor (a string, case-insensitive). It is the only field that separates two monitors of the same model. A DisplayLink monitor reports no vendor, model or serial number, souuidis its only identifying field. -
vendor_id: the hardware vendor ID. A TOML integer, or a'0x'-prefixed hex string such as'0x10AC'. -
model_id: the hardware model ID, in the same two forms, such as'0xD0C1'. -
serial_number: the serial number (a string, exact match). -
display_name: the monitor name (a string). AeroSpork matches it without case: first exactly, then as a substring. It is not a regex. The plain-string pattern is a regex, but this field is not, so'LG|DELL'here matches only a monitor namedLG|DELL. -
width_pixels,height_pixels: the exact size, in points, despite the names. This is the unit of%{monitor-width}and%{monitor-height}.
Every field is optional, and each field has other spellings: bare (vendor, model, serial,
name, width, height), camelCase (vendorID, modelID, serialNumber, displayName,
widthPixels, heightPixels, displayUUID), and display_uuid for uuid. They are the same
fields. Pick one style. The fingerprint wrapper is optional: 2 = { fingerprint = { uuid = '…' } }
is the same as 2 = { uuid = '…' }.
When uuid is present, it decides the match alone, and AeroSpork checks no other field. Otherwise
every field that you give must match: vendor_id, model_id, serial_number, width_pixels and
height_pixels must be equal, and display_name must match as described above. So
{ name = 'DELL', width = 3840 } matches only a DELL monitor that is 3840 points wide. An unknown
field name is an error that rejects the whole config. AeroSpork also rejects a malformed hex value
such as '0xZZZZ', so a typo cannot widen the match.
The Monitors pane of the Settings window edits pins by UUID and by name. It marks a richer
fingerprint, or an array of patterns, with a complex badge. A save from the pane keeps such a
value as it is. Edit it in the Raw TOML pane.
5.8. Window rules
A window rule runs commands when a new window appears. A rule has two forms:
-
The short form,
[on-window]: one line for each app. The key is the bundle ID, and the value is a command or a list of commands.[on-window] "com.apple.mail" = "move-node-to-workspace 3" "com.apple.systempreferences" = "layout floating" "org.alacritty" = ["layout tiling", "move-node-to-workspace T"] -
The long form,
[[on-window-detected]]: one table for each rule, with conditions. Use it to match by app name, window title or workspace, or only at startup. An example with every option:[[on-window-detected]] if.app-id = 'com.apple.systempreferences' if.app-name-regex-substring = 'settings' if.window-title-regex-substring = 'substring' if.workspace = 'workspace-name' if.during-aerospork-startup = true check-further-callbacks = true run = ['layout floating', 'move-node-to-workspace S'] # The commands of the rule
Each [on-window] line is the same as an [[on-window-detected]] rule with only if.app-id.
Send an app to a workspace, or float it shows how to find a bundle ID.
5.8.1. Which rules run
AeroSpork runs the commands of a rule only for a window that matches all the conditions of the rule. A rule with no condition matches every new window.
-
AeroSpork checks the rules in file order, and runs only the first rule that matches. To make AeroSpork also check the rules after a rule, set
check-further-callbacks = truein it. -
AeroSpork adds the
[on-window]rules after the[[on-window-detected]]rules. So a long-form rule that matches the same window runs first, and withoutcheck-further-callbacksit stops the[on-window]rule. -
The Window Rules pane of the Settings window edits both forms. It writes
[on-window]when every rule fits the short form, and[[on-window-detected]]otherwise. Its guided controls write the commands of What a rule can run: Float or Tile, Fullscreen, Sticky, and a move to a workspace, to a monitor or to the scratchpad. A rule whose commands the controls cannot show has acustombadge in place of the controls. Edit it in the "Exact command" field, or click "Start over with guided controls".
5.8.2. What a rule can run
run accepts these commands, and AeroSpork rejects a rule with any other:
-
layout floatingandlayout tiling. AeroSpork rejects otherlayoutarguments here. -
fullscreen on. A rule must sayon: a barefullscreentoggles, so the window would leave fullscreen if the rule ran again. See fullscreen. -
sticky on, for the same reason. See Keep a window on every workspace. -
move-node-to-workspace, move-node-to-monitor and move-node-to-scratchpad. A rule moves its window at most once, with one of the three, and the move is the last command in the list. A move takes the window away from the workspace that the commands before it worked on.
To open an app on another monitor, for example, move its window to that monitor. The window goes to the workspace that the monitor shows:
[on-window]
'com.apple.Music' = 'move-node-to-monitor secondary'
'com.apple.TV' = ['fullscreen on', 'move-node-to-monitor main']
A rule does not take focus unless a move says --focus-follows-window. A rule can run seconds after
its window appears, when AeroSpork asks a slow app again, so the flag can pull you away from what
you are typing in. If you need another command, open an
issue that describes your use case.
5.8.3. When a rule runs
A rule always runs all of its commands. An app does not have to send an event for its new window:
-
If an app does not answer at first, AeroSpork asks again after 1, 2, 4, 8 and 16 seconds.
-
If a new window looks like a popup, AeroSpork checks it again after 1 and 3 seconds.
Thus, a rule applies, and you do not have to click the window.
A rule does not run again on a window that was open when AeroSpork restarted, because that window
went through the rules already. Running them again would undo what you moved by hand. The exception
is a rule with if.during-aerospork-startup = true. A new tab of a window with native tabs does not
run the rules either: it joins the tile of its window.
5.8.4. Conditions
| Condition | What it matches |
|---|---|
|
The bundle ID of the app, exactly |
|
A case-insensitive regex substring of the app name |
|
A case-insensitive regex substring of the window title |
|
The workspace name, exactly |
|
|
-
Use
if.during-aerospork-startup = trueto arrange apps only at startup. -
Use
if.during-aerospork-startup = falsefor a rule with side effects that you do not want on each restart of AeroSpork, such as a rule that opens new windows.
Some apps set the window title after the window opens. A rule with if.window-title-regex-substring
does not match those windows. Match them with if.app-id.
The two regex conditions read only the first 1024 characters of the title or the app name, so a long title cannot slow down every window rule.
5.8.5. Examples
-
Send apps to workspaces:
[on-window] 'org.alacritty' = 'move-node-to-workspace T' # T for Terminal 'com.google.Chrome' = 'move-node-to-workspace W' # W for Web browser 'com.jetbrains.intellij' = 'move-node-to-workspace I' # I for IDE -
Float the windows of an app whose title contains "Preferences":
[[on-window-detected]] if.app-id = 'com.example.app' if.window-title-regex-substring = 'preferences' run = 'layout floating' -
Float every window by default:
[[on-window-detected]] check-further-callbacks = true run = 'layout floating'
5.9. Event callbacks
5.9.1. on-focus-changed, on-focused-workspace-changed, on-focused-monitor-changed
Three event callbacks run commands when the focus changes:
-
on-focus-changedruns each time the focused window or the focused workspace changes. -
on-focused-workspace-changedruns each time the focused workspace changes. -
on-focused-monitor-changedruns each time the focused monitor changes.
A command run by on-focused-workspace-changed gets AEROSPORK_FOCUSED_WORKSPACE, the workspace
that you switched to, and AEROSPORK_PREV_WORKSPACE, the workspace that you switched from.
Run a script when focus changes has examples.
-
The order in which AeroSpork runs the callbacks can change between versions. Do not depend on it.
-
A focus change inside a callback does not start the callback again. A change of focus inside these callbacks is not a supported pattern, and its handling can change in a later version.
5.9.2. on-mode-changed
on-mode-changed runs each time the binding mode changes: after mode <name>, after you leave a mode
from the menu, and after a reload that drops the mode you were in, which puts you back in main. It
does not run at startup, for mode with the mode you are already in, or for enable.
A command run by on-mode-changed gets AEROSPORK_MODE, the mode that you switched to, and
AEROSPORK_PREV_MODE, the mode that you switched from. A status bar can show the mode without asking
list-modes --current again and again:
on-mode-changed = ['exec-and-forget sketchybar --trigger aerospork_mode_change MODE=$AEROSPORK_MODE']
A mode command inside the callback changes the mode, but does not start the callback again.
In the Settings window, the "Binding mode changed" section of the Events pane edits
on-mode-changed. A status bar can also read the mode-changed event of aerospork subscribe,
which starts no process for each change. See Build a status bar.
5.9.3. exec-on-workspace-change (deprecated)
exec-on-workspace-change runs a process when the focused workspace changes. It still works, and
AeroSpork writes a warning about it. Use on-focused-workspace-changed with
exec-and-forget instead. That form gets the same two variables:
# Deprecated
exec-on-workspace-change = ['/bin/bash', '-c',
'sketchybar --trigger aerospork_workspace_change FOCUSED_WORKSPACE=$AEROSPORK_FOCUSED_WORKSPACE'
]
# The replacement
on-focused-workspace-changed = ['exec-and-forget sketchybar --trigger aerospork_workspace_change FOCUSED_WORKSPACE=$AEROSPORK_FOCUSED_WORKSPACE']
The process gets the exec environment, plus AEROSPORK_FOCUSED_WORKSPACE and
AEROSPORK_PREV_WORKSPACE.
5.10. The environment of exec commands
The exec section sets the environment of exec-* commands and of the commands that callbacks run,
such as exec-and-forget and
exec-on-workspace-change (deprecated).
|
Warning
|
A command in your config runs with the full environment of AeroSpork, including any
secrets in it. A config snippet that you copy from the internet can read them. To pass only the
variables that you name, set exec.inherit-env-vars = false and list them under [exec.env-vars].
|
exec.inherit-env-vars sets whether a command gets the environment of AeroSpork.app. The built-in
default is true. To set a variable, add it to [exec.env-vars]. A value can use other variables in
the form ${ENV_VAR}:
[exec.env-vars]
PATH = '${HOME}/bin:${PATH}'
A macOS app does not have the Homebrew prefix in its PATH
(docs.brew.sh). So when your
config has no exec section, AeroSpork uses this one:
[exec]
inherit-env-vars = true
[exec.env-vars]
PATH = '/opt/homebrew/bin:/opt/homebrew/sbin:${PATH}'
When a command has a target, AeroSpork also sets:
-
AEROSPORK_WINDOW_ID: the window that the command acts on. -
AEROSPORK_WORKSPACE: the workspace that the command acts on, when the target is an empty workspace and not a window.
To see the resulting environment, run
aerospork list-exec-env-vars.
5.11. Settings window details
The Settings window edits your config. Open the Settings window lists the ways to open it, and the
open-settings command opens it from a binding or the CLI.
There is only one Settings window. If it is open, a new request brings it to the front, even when
another app is frontmost. AeroSpork never tiles the Settings window or moves it to a workspace.
The window has seven panes: General, Gaps, Keys, Monitors, Events, Window Rules and Raw TOML. It opens at 880 × 620 points, you can resize it down to 780 × 520, and it opens again on the pane that you selected last.
5.11.1. How a change applies
-
A change in a structured pane applies about 0.6 seconds after your last change. There is no Save button. If you close the window first, AeroSpork saves the change.
-
A save changes only the lines that you edited, so your comments and formatting survive. The exceptions are gaps and window rules: when you edit them, AeroSpork writes the whole section again.
-
AeroSpork writes a new section in the v2 spelling.
-
A saved change takes effect on screen at once.
5.11.2. Raw TOML
The Raw TOML pane shows the whole config, so every key is in reach of the Settings window. It applies only when you click Apply, because half-typed TOML is usually invalid. It has native Find, line numbers, horizontal scrolling, TOML highlighting, navigation by section, the cursor position, and parser errors that link to the line.
5.11.3. Backups
The first time the Settings window saves after you open it, and each time you apply Raw TOML,
AeroSpork writes a backup next to your config: <config>.toml.<yyyyMMdd-HHmmss>.backup. AeroSpork
keeps the five most recent backups. The Restore menu of the Raw TOML pane lists them.
When your config is a symbolic link, for example from a dotfiles repository, a save writes the file that the link points to and keeps the link. The backups go next to the link, and each one holds the contents of the file. When the file is in a folder that AeroSpork cannot write, such as the Nix store, AeroSpork refuses the save, so edit the file where it is managed. A save replaces the file, so a hard link to your config keeps the old contents.
5.11.4. What the Settings window does not change
AeroSpork reads each save back before it writes it. AeroSpork refuses an edit that would not come out right, and points you to Raw TOML. The cause is either how the file spells that value (a dotted or inline form, or a multi-line array), or a file that mixes Windows and Unix line endings.
A pane marks a value that its controls cannot show, such as a hardware fingerprint or a list of
fallback monitors, with a complex badge. A save keeps that value as it is, unless you edit that
row. Edit it in the Raw TOML pane.
5.11.5. The menu bar icon and the Dock icon
show-menu-bar-icon = false together with show-dock-icon = false does not hide both. Without the
menu bar icon, AeroSpork shows the Dock icon, so that something visible always leads back to the
Settings window. Opening AeroSpork again, or aerospork open-settings, also opens the Settings
window.
5.12. The default config
The default config ships inside the app, and AeroSpork uses it when you have no config. To make it yours, copy it as in Make the config yours.
# AeroSpork: the default config
#
# AeroSpork ships this file inside the app and uses it when you have no config of your own.
# To make it yours, copy it and edit the copy:
# cp /Applications/AeroSpork.app/Contents/Resources/default-config.toml ~/.aerospork.toml
# (A debug build reads ~/.aerospork-debug.toml instead.)
#
# Every key below is optional. If you delete a key, AeroSpork uses its built-in default, and that
# is not always the value shown here: without [gaps] the gaps are 0, and without `mod` AeroSpork
# generates no bindings. If you delete your copy, AeroSpork uses this file again.
# A saved change applies at once.
#
# The guide documents every key: https://aerospork.app/docs/guide.html
# Each command has a page: `aerospork <command> --help`, or `man aerospork-<command>`.
# ---------------------------------------------------------------------------------------------
# The two lines most people ever need
# ---------------------------------------------------------------------------------------------
# Base modifier for the generated bindings listed under [keys] below.
# If you remove this line, AeroSpork generates no bindings, and you bind everything yourself.
mod = "alt"
# Workspaces you want. A range ("1-9"), a list (["dev", "web", "chat"]), or both (["1-9", "dev"]).
# Each one gets mod-<key> -> switch to it
# mod-shift-<key> -> move the focused window to it
# where <key> is the first character of the name, lower-cased ("dev" -> mod-d).
# Workspaces listed here always exist, even while empty, so the menu bar, `list-workspaces` and
# `workspace next/prev` show all of them. AeroSpork creates any other workspace when you switch to
# it, and releases it when it is empty.
workspaces = "1-9"
# ---------------------------------------------------------------------------------------------
# Gaps
# ---------------------------------------------------------------------------------------------
[gaps]
inner = 8 # between windows
outer = 8 # between windows and the monitor edge
# Per-edge instead: outer = { top = 32, bottom = 8, left = 8, right = 8 }
# Per-monitor: outer = [{ monitor.main = 16 }, 8]
# ---------------------------------------------------------------------------------------------
# Keys
# ---------------------------------------------------------------------------------------------
#
# AeroSpork generates these from `mod`, and they are already active. They are listed here so
# that you can see them:
#
# mod-h / j / k / l focus left / down / up / right
# mod-shift-h / j / k / l move window
# mod-minus / mod-equal shrink / grow
# mod-slash / mod-comma tiles / accordion layout
# mod-tab previous workspace
#
# Anything you put in [keys] wins over a generated binding with the same key.
[keys]
alt-shift-semicolon = "mode service"
# alt-enter = "exec-and-forget open -na Ghostty"
# Trade places with the next window. Focus goes along, so press again to keep moving it.
alt-shift-enter = "swap dfs-next --wrap-around"
# Float the focused window and keep it on screen on every workspace of its monitor. Again to stop.
alt-shift-s = "sticky"
# The scratchpad, as in i3: put the focused window out of sight, and call it up on any workspace.
# i3 calls it up with mod-minus, which shrinks the window here, so it is mod-backtick.
alt-shift-minus = "move-node-to-scratchpad"
alt-backtick = "scratchpad"
# A binding mode. Enter it with `mode <name>`. Leave it with `mode main`.
[keys.service]
esc = ["reload-config", "mode main"]
r = ["flatten-workspace-tree", "mode main"]
f = ["layout floating tiling", "mode main"]
backspace = ["close-all-windows-but-current", "mode main"]
# ---------------------------------------------------------------------------------------------
# Monitors
# ---------------------------------------------------------------------------------------------
#
# Pin a workspace to a monitor. The value can be:
# "main" / "secondary" the main monitor / the other one, when there are exactly two
# 2 monitor by position, left to right
# "LG|DELL" case-insensitive regex on the name
# { uuid = "..." } the exact monitor: survives docking and identical models
# { vendor = "0x10AC", model = "0x4276" }
#
# Run `aerospork list-monitors --format '%{monitor-fingerprint}'` to see what to put here.
# Prefer `uuid`: it is the only key that separates two monitors of the same model, and the only
# one DisplayLink panels have at all.
# [monitors]
# 1 = "main"
# 2 = { uuid = "AAAAAAAA-0000-4000-8000-000000000001" }
# ---------------------------------------------------------------------------------------------
# Window rules
# ---------------------------------------------------------------------------------------------
#
# A window rule runs when a window of the app appears. The key is the bundle ID of the app
# (`aerospork list-apps` prints them). To match by app name, window title or workspace, use
# : https://aerospork.app/docs/guide.html#on-window-detected-callback
# [on-window]
# "com.apple.mail" = "move-node-to-workspace 3"
# "com.apple.systempreferences" = "layout floating"
# ---------------------------------------------------------------------------------------------
# Everything else
# ---------------------------------------------------------------------------------------------
# start-at-login = false
# accordion-padding = 30
# default-root-container-layout = "tiles" # tiles | accordion
# default-root-container-orientation = "auto" # auto | horizontal | vertical
# new-window-placement = "sibling" # sibling | nest: a new window shares the focused tile
#
# Run something after AeroSpork starts:
# after-startup-command = ["exec-and-forget sketchybar --reload"]
#
# Run something when focus moves. `move-mouse window-lazy-center` makes the pointer follow you,
# including between workspaces on the same monitor:
# on-focused-workspace-changed = ["move-mouse window-lazy-center"]