AeroSpork is an i3-like tiling window manager for macOS

300

Run each command from a terminal as aerospork <command>, or from a binding or a callback in the config without the aerospork prefix. The query commands work only from the CLI, except list-exec-env-vars. exec-and-forget works only in the config. Every command exits with one of the codes in Exit status. Each command also has a man page: run man aerospork-<command>.

In this reference, a node is a window or a container in the tree. In practice, the commands move windows.

1. Focus

1.1. focus

focus [-h|--help] [--ignore-floating]
      [--boundaries <boundary>] [--boundaries-action <boundary-action>]
      (left|down|up|right)
focus [-h|--help] --window-id <window-id>
focus [-h|--help] --dfs-index <dfs-index>

Focus the nearest window in a direction.

focus left focuses the nearest window to the left of the focused window, and so on for the other directions. By default focus stays inside the focused workspace: at its edge, nothing happens. --boundaries and --boundaries-action change what happens at the edge.

Unlike i3, focus has no separate argument for floating windows. It treats each floating window as part of the tree, at its position on the screen, so one binding reaches every window. --ignore-floating turns that off.

focus has no child or parent argument.

OPTIONS

-h, --help

Print help and exit.

--boundaries <boundary>

Where the edge is. The default is workspace.

  • workspace: the edge of the focused workspace.

  • all-monitors-outer-frame: the outer edge of all monitors together. At the edge of a monitor inside that frame, focus goes to the next monitor in that direction.

--boundaries-action <boundary-action>

What happens at the edge. The default is stop.

  • stop: nothing changes, and the command exits 0.

  • fail: nothing changes, and the command exits 1.

  • wrap-around-the-workspace: focus the window at the opposite edge of the workspace.

  • wrap-around-all-monitors: focus the monitor at the opposite end. This action requires --boundaries all-monitors-outer-frame, so AeroSpork rejects focus --boundaries-action wrap-around-all-monitors left alone.

--window-id <window-id>

Focus the window with this ID, on any workspace. A minimized window, or a window of a hidden app, comes back first. Incompatible with every other option.

--dfs-index <dfs-index>

Focus the window at this position in a depth-first walk of the tiled windows of the focused workspace. The first window is 0. Incompatible with every other option.

--ignore-floating

Leave floating windows out of the tree. A script then gets the same result whatever floats.

ARGUMENTS

(left|down|up|right)

The direction to look for a window in.

EXIT STATUS

The exit status follows the rules for every command.

focus exits 1 when no window is focused, when no window has the ID or the index, and at the edge with --boundaries-action fail.

EXAMPLES

  • Move focus across monitors, and wrap from the last monitor to the first:
    aerospork focus --boundaries all-monitors-outer-frame --boundaries-action wrap-around-all-monitors right

  • Focus the first tiled window of the workspace:
    aerospork focus --dfs-index 0

SEE ALSO

aerospork(1), aerospork-focus-back-and-forth(1), aerospork-focus-monitor(1), aerospork-move(1)

1.2. focus-back-and-forth

focus-back-and-forth [-h|--help]

Focus the window or empty workspace that had focus before.

focus-back-and-forth focuses whatever had focus before: a window, or an empty workspace. Run it twice to go back to where you started.

AeroSpork remembers only one previous focus. When you close the window that had focus before, focus-back-and-forth has nothing to go back to and exits 1.

OPTIONS

-h, --help

Print help and exit.

EXIT STATUS

The exit status follows the rules for every command.

focus-back-and-forth exits 1 when the previous window is closed.

EXAMPLES

  • Go back to the previous window, or else to the previous workspace:
    aerospork focus-back-and-forth || aerospork workspace-back-and-forth

    The second command also fails when there is no previous workspace yet.

SEE ALSO

aerospork(1), aerospork-workspace-back-and-forth(1), aerospork-focus(1)

1.3. focus-monitor

focus-monitor [-h|--help] [--wrap-around] (left|down|up|right)
focus-monitor [-h|--help] [--wrap-around] (next|prev)
focus-monitor [-h|--help] <monitor-pattern>...

Focus a monitor by direction, by order, or by pattern.

focus-monitor focuses the visible workspace of another monitor, and the window on it that had focus last. No window moves.

OPTIONS

-h, --help

Print help and exit.

--wrap-around

At the last monitor, go on to the first, and the reverse. Incompatible with <monitor-pattern>.

ARGUMENTS

(left|down|up|right)

The nearest monitor in that direction from the focused monitor.

(next|prev)

The next or the previous monitor in monitor order. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

<monitor-pattern>…​

One or more monitor patterns. AeroSpork tries them in order and uses the first monitor that matches. Several patterns let one command work with different monitor setups. Each pattern is one of:

  • A monitor number, in the monitor order that next and prev use.

  • main: the main monitor.

  • secondary: the monitor that is not the main monitor, when exactly two monitors are connected.

  • A case-insensitive regular expression, matched against the monitor name.

These are the string patterns of the [monitors] config section. A fingerprint table such as { uuid = "…​" } works only in the config.

EXIT STATUS

The exit status follows the rules for every command.

focus-monitor exits 1 when no monitor is in that direction or in that position, and when no pattern matches.

EXAMPLES

  • Focus the monitor to the right, and wrap to the leftmost one:
    aerospork focus-monitor --wrap-around right

  • Focus the built-in display if it is connected, else the main monitor:
    aerospork focus-monitor 'built-in' main

SEE ALSO

aerospork(1), aerospork-list-monitors(1), aerospork-move-node-to-monitor(1), aerospork-move-workspace-to-monitor(1)

2. Move windows and workspaces

2.1. move

move [-h|--help] [--window-id <window-id>] [--boundaries <boundary>] [--boundaries-action <boundary-action>] (left|down|up|right)

Move the focused window in a direction.

move left moves the focused window one place to the left in the tree, and so on for the other directions. The window swaps places with a neighbor, moves into the container beside it, or moves out of its own container. The examples show each case.

A floating window moves 50 points in that direction and stops at the edge of its monitor. At the edge, --boundaries all-monitors-outer-frame takes it to the next monitor.

Old spelling, still accepted: move-through.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

--boundaries <boundary>

Where the edge is. The default is workspace.

  • workspace: the edge of the workspace.

  • all-monitors-outer-frame: the outer edge of all monitors together. At the edge of a monitor inside that frame, the window moves to the next monitor in that direction.

--boundaries-action <boundary-action>

What happens at the edge. The default is create-implicit-container.

  • stop: nothing changes, and the command exits 0.

  • fail: nothing changes, and the command exits 1.

  • create-implicit-container: put the other windows of the workspace in a new container, and put the window beside it in that direction. See the last example.

ARGUMENTS

(left|down|up|right)

The direction to move the window in.

EXIT STATUS

The exit status follows the rules for every command.

move exits 1 when no window is focused, for a minimized window, a macOS fullscreen window or a window of a hidden app, and at the edge with --boundaries-action fail.

EXAMPLES

  1. Given this layout

    h_tiles
    ├── window 1 (focused)
    └── window 2

    move right gives this layout

    h_tiles
    ├── window 2
    └── window 1 (focused)
  2. Given this layout

    h_tiles
    ├── window 1
    ├── window 2 (focused)
    └── v_tiles
        ├── window 3
        └── window 4

    move right gives this layout

    h_tiles
    ├── window 1
    └── v_tiles
        ├── window 3
        ├── window 2 (focused)
        └── window 4
  3. Given this layout

    h_tiles
    ├── window 1
    └── v_tiles
        ├── window 3
        ├── window 2 (focused)
        └── window 4

    move left gives this layout

    h_tiles
    ├── window 1
    ├── window 2 (focused)
    └── v_tiles
        ├── window 3
        └── window 4
  4. Implicit container example

    Sometimes move has to create a container to do what you asked.

    Given this layout

    h_tiles
    ├── window 1
    ├── window 2 (focused)
    └── window 3

    move up gives this layout

    v_tiles
    ├── window 2 (focused)
    └── h_tiles
        ├── window 1
        └── window 3

    move created the v_tiles container.

    With --boundaries all-monitors-outer-frame and a monitor above, move creates no container. It moves window 2 to the monitor above.

SEE ALSO

aerospork(1), aerospork-focus(1), aerospork-join-with(1), aerospork-move-node-to-workspace(1), aerospork-move-node-to-monitor(1)

2.2. swap

swap [-h|--help] [--window-id <window-id>] [--swap-focus] [--wrap-around]
     (left|down|up|right|dfs-next|dfs-prev)

Swap the focused window with another window and keep the layout.

swap trades the places of two tiled windows. Each window takes the other’s place and the other’s size, so the layout stays the same. move reshapes the tree when a window crosses into another container, and swap never does.

swap left swaps with the nearest window to the left, as focus left would pick it, and so on for the other directions. swap dfs-next and swap dfs-prev swap with the next or the previous window in a depth-first walk of the tiled windows of the workspace, the order that focus --dfs-index counts in.

The focused window keeps the focus, so focus moves with it to its new place. A native tab group is one tile, so swap moves the whole group. swap works only on tiled windows: a floating window has no place in the tree to trade.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

--swap-focus

Give the focus to the other window, which now sits where the focused window was. Focus stays in the same place on the screen.

--wrap-around

At the edge of the workspace, swap with the window at the opposite edge. With dfs-next and dfs-prev, the last window swaps with the first.

ARGUMENTS

(left|down|up|right|dfs-next|dfs-prev)

The window to swap with.

EXIT STATUS

The exit status follows the rules for every command.

swap exits 1 when no window is focused, when the window is not tiled, and when there is no window to swap with, for example at the edge of the workspace without --wrap-around.

EXAMPLES

  • Given this layout

    h_tiles
    ├── window 1 (focused)
    └── v_tiles
        ├── window 2
        └── window 3

    swap right gives this layout when window 2 was focused more recently than window 3. move right would put window 1 into the v_tiles container instead.

    h_tiles
    ├── window 2
    └── v_tiles
        ├── window 1 (focused)
        └── window 3

SEE ALSO

aerospork(1), aerospork-move(1), aerospork-focus(1)

2.3. move-node-to-workspace

move-node-to-workspace [-h|--help] [--focus-follows-window] [--wrap-around]
                       (next|prev)
move-node-to-workspace [-h|--help] [--focus-follows-window] [--fail-if-noop]
                       [--window-id <window-id>] <workspace>

Move the focused window to another workspace.

move-node-to-workspace moves the focused window to <workspace>. Focus stays on the workspace where it was, unless you give --focus-follows-window. When no workspace has that name, AeroSpork creates it. A sticky window stops being sticky. See aerospork-sticky(1).

next and prev pick the workspace as workspace next and workspace prev do, and they read the list from stdin in the same way. See aerospork-workspace(1).

OPTIONS

-h, --help

Print help and exit.

--wrap-around

With next or prev, go on from the last workspace to the first, and the reverse.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Incompatible with next and prev.

--focus-follows-window

Focus the window after the move. This has the same effect as workspace <workspace> after the move.

--window-id <window-id>

Act on the specified window instead of the focused window Incompatible with next and prev.

ARGUMENTS

(next|prev)

The next or the previous workspace.

<workspace>

The name of the workspace to move the window to.

EXIT STATUS

The exit status follows the rules for every command.

move-node-to-workspace exits 1 when no window is focused, and with next or prev when there is no next or previous workspace. With --fail-if-noop, it also exits 1 when the window is already on <workspace>.

EXAMPLES

  • Send the focused window to workspace 3, and go with it:
    aerospork move-node-to-workspace --focus-follows-window 3

  • Send every new Mail window to workspace 3, with a window rule:

    [on-window]
    "com.apple.mail" = "move-node-to-workspace 3"

SEE ALSO

aerospork(1), aerospork-workspace(1), aerospork-move-node-to-monitor(1), the guide on window rules

2.4. move-node-to-monitor

move-node-to-monitor [-h|--help] [--window-id <window-id>] [--focus-follows-window]
                     [--wrap-around] (left|down|up|right|next|prev)
move-node-to-monitor [-h|--help] [--window-id <window-id>] [--focus-follows-window]
                     [--fail-if-noop] <monitor-pattern>...

Move the focused window to another monitor.

move-node-to-monitor moves the focused window to the visible workspace of another monitor. Focus stays on the workspace where it was, unless you give --focus-follows-window. You choose the monitor by direction, by order, or by pattern. A sticky window stops being sticky. See aerospork-sticky(1).

OPTIONS

-h, --help

Print help and exit.

--wrap-around

At the last monitor, go on to the first, and the reverse. Incompatible with <monitor-pattern>.

--focus-follows-window

Focus the window after the move.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Works only with <monitor-pattern>.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

(left|down|up|right)

The nearest monitor in that direction from the monitor of the window.

(next|prev)

The next or the previous monitor in monitor order. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

<monitor-pattern>…​

One or more monitor patterns. AeroSpork tries them in order and uses the first monitor that matches. Several patterns let one command work with different monitor setups. Each pattern is one of:

  • A monitor number, in the monitor order that next and prev use.

  • main: the main monitor.

  • secondary: the monitor that is not the main monitor, when exactly two monitors are connected.

  • A case-insensitive regular expression, matched against the monitor name.

These are the string patterns of the [monitors] config section. A fingerprint table such as { uuid = "…​" } works only in the config.

EXIT STATUS

The exit status follows the rules for every command.

move-node-to-monitor exits 1 when no window is focused, when no monitor is in that direction or in that position, and when no pattern matches. With --fail-if-noop, it also exits 1 when the window is already on the target monitor.

EXAMPLES

  • Send the focused window to the next monitor, and go with it:
    aerospork move-node-to-monitor --wrap-around --focus-follows-window next

SEE ALSO

aerospork(1), aerospork-focus-monitor(1), aerospork-move-node-to-workspace(1), aerospork-move-workspace-to-monitor(1)

2.5. move-node-to-scratchpad

move-node-to-scratchpad [-h|--help] [--window-id <window-id>] [--fail-if-noop]

Put a window away in the scratchpad, off screen and on no workspace.

move-node-to-scratchpad takes a window off its workspace and puts it in the scratchpad. The scratchpad belongs to no workspace, and AeroSpork keeps its windows off screen. aerospork scratchpad brings a window back onto the focused workspace, and puts it away again. Use it for a terminal, a notes app or a music player that you want to call up from any workspace.

A tiled window leaves its tile. It comes back floating, centred on the monitor, at its floating size. A sticky window stops being sticky, and a window that aerospork fullscreen made fullscreen comes back at its floating size.

You can also use move-node-to-scratchpad in a window rule, as the last command of run. A window that the rule matches then goes to the scratchpad when it opens.

list-windows and list-workspaces do not show the windows in the scratchpad, as they do not show minimized windows. AeroSpork remembers which windows are in the scratchpad when it restarts.

OPTIONS

-h, --help

Print help and exit.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr.

--window-id <window-id>

Act on the specified window instead of the focused window

EXIT STATUS

The exit status follows the rules for every command.

move-node-to-scratchpad exits 1 when no window is focused, and when the window is minimized, in macOS fullscreen or a window of a hidden app. With --fail-if-noop, it also exits 1 when the window is already in the scratchpad.

EXAMPLES

  • Put the focused window away with a binding, and call it back with another:

    [keys]
    alt-shift-minus = 'move-node-to-scratchpad'
    alt-backtick = 'scratchpad'
  • Put every new window of an app in the scratchpad when it opens:

    [[on-window-detected]]
        if.app-id = 'com.apple.Notes'
        run = 'move-node-to-scratchpad'

SEE ALSO

aerospork(1), aerospork-scratchpad(1), aerospork-sticky(1), aerospork-move-node-to-workspace(1)

2.6. scratchpad

scratchpad [-h|--help] [--app-bundle-id <app-bundle-id>]

Show a window from the scratchpad, or put the focused one back.

scratchpad shows a window from the scratchpad, and puts it away again. aerospork move-node-to-scratchpad puts a window in the scratchpad.

  • When the focused window came from the scratchpad, scratchpad puts it back.

  • When a window from the scratchpad is on the focused workspace, scratchpad focuses it.

  • Otherwise, scratchpad brings the window that you put away last onto the focused workspace, and focuses it. The window floats, centred on the monitor, at its floating size. A minimized window comes back from the Dock. When the scratchpad is empty, a window from the scratchpad that is on another workspace moves to this one.

A window from the scratchpad stays on the workspace where you showed it, like any floating window, until you put it back. It stops being a scratchpad window when you move it with move-node-to-workspace or move-node-to-monitor, tile it with layout tiling, or make it sticky.

OPTIONS

-h, --help

Print help and exit.

--app-bundle-id <app-bundle-id>

Only the windows of the app with this bundle ID. With it, each app can have a binding of its own.

EXIT STATUS

The exit status follows the rules for every command.

scratchpad exits 1 when no window from the scratchpad matches.

EXAMPLES

  • Put a window away and call it back:

    [keys]
    alt-shift-minus = 'move-node-to-scratchpad'
    alt-backtick = 'scratchpad'
  • A dropdown terminal: one binding for Terminal, which a window rule puts in the scratchpad when it opens:

    [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'

SEE ALSO

aerospork(1), aerospork-move-node-to-scratchpad(1), aerospork-layout(1)

2.7. move-workspace-to-monitor

move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (left|down|up|right)
move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (next|prev)
move-workspace-to-monitor [-h|--help] [--workspace <workspace>] <monitor-pattern>...

Move the focused workspace to another monitor.

move-workspace-to-monitor makes a workspace the visible workspace of another monitor, with all its windows. Focus goes with the workspace. Directions and next/prev count from the monitor that the workspace is on now: with --workspace, that is not always the focused monitor.

The command fails for a workspace that the config pins to a monitor.

Old spelling, still accepted: move-workspace-to-display.

OPTIONS

-h, --help

Print help and exit.

--wrap-around

At the last monitor, go on to the first, and the reverse. Incompatible with <monitor-pattern>.

--workspace <workspace>

Act on the specified workspace instead of the focused workspace

ARGUMENTS

(left|down|up|right)

The nearest monitor in that direction from the monitor of the workspace.

(next|prev)

The next or the previous monitor in monitor order, from the monitor of the workspace. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

<monitor-pattern>…​

One or more monitor patterns. AeroSpork tries them in order and uses the first monitor that matches. Several patterns let one command work with different monitor setups. Each pattern is one of:

  • A monitor number, in the monitor order that next and prev use.

  • main: the main monitor.

  • secondary: the monitor that is not the main monitor, when exactly two monitors are connected.

  • A case-insensitive regular expression, matched against the monitor name.

These are the string patterns of the [monitors] config section. A fingerprint table such as { uuid = "…​" } works only in the config.

EXIT STATUS

The exit status follows the rules for every command.

move-workspace-to-monitor exits 1 for a pinned workspace, when no monitor is in that direction or in that position, and when no pattern matches. When the workspace is already on the target monitor, it exits 0.

EXAMPLES

  • Move the focused workspace to the next monitor, and wrap to the first:
    aerospork move-workspace-to-monitor --wrap-around next

  • Move workspace web to the main monitor:
    aerospork move-workspace-to-monitor --workspace web main

SEE ALSO

aerospork(1), aerospork-summon-workspace(1), aerospork-focus-monitor(1), aerospork-move-node-to-monitor(1)

2.8. move-mouse

move-mouse [-h|--help] [--fail-if-noop] <mouse-position>

Move the mouse pointer to the focused window or monitor.

move-mouse moves the mouse pointer to the center of the focused window or of the focused monitor. With a lazy position, the pointer moves only when it is outside the window or the monitor.

On an empty workspace no window has focus, so both window-* positions use the focused monitor. Otherwise the pointer would stay on the monitor that you left. In on-focused-workspace-changed, a callback is a list of commands with no shell ||, so it needs that fallback built in.

OPTIONS

-h, --help

Print help and exit.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Works only with window-lazy-center and monitor-lazy-center.

ARGUMENTS

<mouse-position>

Where to move the pointer:

  • monitor-lazy-center: the center of the focused monitor, unless the pointer is already on that monitor.

  • monitor-force-center: the center of the focused monitor.

  • window-lazy-center: the center of the focused window, unless the pointer is already inside that window.

  • window-force-center: the center of the focused window.

EXIT STATUS

The exit status follows the rules for every command.

With --fail-if-noop, move-mouse exits 1 when the pointer is already inside the window or the monitor.

EXAMPLES

  • Make the mouse follow focus:

    on-focus-changed = ['move-mouse window-lazy-center']

SEE ALSO

aerospork(1), aerospork-focus(1), aerospork-focus-monitor(1)

3. Layout

3.1. layout

layout [-h|--help] [--window-id <window-id>]
       (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)...

Change the layout of the focused window, or float it.

layout changes the layout or the orientation of the container that holds the focused window, or makes the window float or tile.

With several arguments, layout applies the first argument that does not match the current layout. So two arguments toggle between them, and the order of the arguments does not matter.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

h_tiles, v_tiles, h_accordion, v_accordion

Set the layout and the orientation of the container.

tiles, accordion

Set the layout of the container, and keep its orientation.

horizontal, vertical

Set the orientation of the container, and keep its layout.

tiling, floating

Make the window tile or float.

Old spellings, still accepted: list, h_list and v_list for tiles, h_tiles and v_tiles.

EXIT STATUS

The exit status follows the rules for every command.

layout exits 1 when no window is focused, and for a minimized window, a macOS fullscreen window or a window of a hidden app.

EXAMPLES

  • Toggle between floating and tiling:
    aerospork layout floating tiling

  • Toggle the orientation:
    aerospork layout horizontal vertical

  • Toggle between tiles and accordion:
    aerospork layout tiles accordion

  • Switch to tiles. When the container is already tiles, toggle its orientation:
    aerospork layout tiles horizontal vertical

SEE ALSO

aerospork(1), aerospork-join-with(1), aerospork-split(1), aerospork-fullscreen(1), the guide on floating windows

3.2. join-with

join-with [-h|--help] [--window-id <window-id>] (left|down|up|right)

Put the focused window and its neighbor in a new container.

join-with puts the focused window and its neighbor in that direction into a new tiles container. The neighbor is the nearest node in that direction: a window, or a container. The new container takes the place of the neighbor, with the opposite orientation of its parent.

join-with replaces the split command of i3. You split a node almost always to put several windows under one parent, and join-with does that in one step. Unlike split, it works with enable-normalization-flatten-containers on.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

(left|down|up|right)

The direction of the neighbor to join.

EXIT STATUS

The exit status follows the rules for every command.

join-with exits 1 when no window is focused, and when there is no node in that direction.

EXAMPLES

  • Given this layout

    h_tiles
    ├── window 1
    ├── window 2 (focused)
    └── window 3

    join-with right gives this layout

    h_tiles
    ├── window 1
    └── v_tiles
        ├── window 2 (focused)
        └── window 3

SEE ALSO

aerospork(1), aerospork-split(1), aerospork-flatten-workspace-tree(1), aerospork-layout(1)

3.3. split

split [-h|--help] [--window-id <window-id>] (horizontal|vertical|opposite)

Split the focused window, as i3 does.

split exists only for compatibility with i3. Use join-with unless you have a reason not to. With enable-normalization-flatten-containers on, normalization removes a container that holds one window, so split fails next to other windows, and its error says what to run instead. join-with works with it on. On a workspace that holds one window, split works with it on too: it sets the direction the next window opens in.

When the parent container of the focused window has more than one child, split:

  1. Creates a new tiles container with the orientation that the argument gives.

  2. Puts the new container in the place of the focused window.

  3. Puts the focused window into the new container, as its only child.

When the focused window is the only child of its parent container, split changes the orientation of that container.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

horizontal

A horizontal container.

vertical

A vertical container.

opposite

The opposite orientation of the parent container.

EXIT STATUS

The exit status follows the rules for every command.

split exits 1 when it would nest a window while enable-normalization-flatten-containers is on, when no window is focused, and for a floating window.

EXAMPLES

  • Split the focused window vertically:
    aerospork split vertical

SEE ALSO

aerospork(1), aerospork-join-with(1), aerospork-layout(1)

3.4. resize

resize [-h|--help] [--window-id <window-id>] (smart|smart-opposite|width|height) [+|-]<number>

Resize the focused window.

resize changes the width or the height of a window by <number> points, or sets it to <number> points.

For a tiled window, resize changes the size of the window, or of the nearest container around it, in a tiles layout with that orientation. The other children of the same container share the difference. When no container around the window is a tiles layout with that orientation, for example in an accordion layout, the command fails.

A floating window changes its own size. For it, smart changes the width and smart-opposite changes the height. The window stays on its monitor, and moves back onto the monitor when it grows past the edge.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

(smart|smart-opposite|width|height)

The dimension to change:

  • width: the width.

  • height: the height.

  • smart: the width in a horizontal container, and the height in a vertical container.

  • smart-opposite: the other dimension.

[+|-]<number>

The change, in points:

  • +<number>: make the dimension larger by <number> points.

  • -<number>: make the dimension smaller by <number> points.

  • <number>: make the dimension <number> points.

EXIT STATUS

The exit status follows the rules for every command.

resize exits 1 when no window is focused, when no container around the window is a tiles layout with that orientation, and for a floating window on an off-screen workspace.

EXAMPLES

  • Make the focused window 50 points wider:
    aerospork resize width +50

  • Resize with bindings:

    [keys]
    alt-minus = 'resize smart -50'
    alt-equal = 'resize smart +50'

SEE ALSO

aerospork(1), aerospork-balance-sizes(1), aerospork-layout(1)

3.5. balance-sizes

balance-sizes [-h|--help] [--workspace <workspace>]

Give the windows of the focused workspace equal sizes.

balance-sizes gives every window and container in a tiles layout an equal share of its parent container. Use it after a resize to go back to an even split.

Windows in an accordion layout and floating windows keep their size.

OPTIONS

-h, --help

Print help and exit.

--workspace <workspace>

Act on the specified workspace instead of the focused workspace

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Even out the focused workspace:
    aerospork balance-sizes

  • Even out workspace 2, visible or not:
    aerospork balance-sizes --workspace 2

SEE ALSO

aerospork(1), aerospork-resize(1), aerospork-flatten-workspace-tree(1)

3.6. flatten-workspace-tree

flatten-workspace-tree [-h|--help] [--workspace <workspace>]

Put every tiled window of the focused workspace in one container.

flatten-workspace-tree moves every tiled window of the workspace out of its nested container. Each tiled window becomes a direct child of the root container, in tree order, and the empty containers go away. The root container keeps its layout and orientation. Floating windows do not move.

Use it to reset a layout, when a reset is quicker than a repair by hand.

OPTIONS

-h, --help

Print help and exit.

--workspace <workspace>

Act on the specified workspace instead of the focused workspace

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Given this layout

    h_tiles
    ├── window 1
    └── v_tiles
        ├── window 2
        └── window 3

    flatten-workspace-tree gives this layout

    h_tiles
    ├── window 1
    ├── window 2
    └── window 3

SEE ALSO

aerospork(1), aerospork-balance-sizes(1), aerospork-join-with(1), aerospork-layout(1)

3.7. fullscreen

fullscreen [-h|--help]     [--window-id <window-id>] [--no-outer-gaps]
fullscreen [-h|--help] on  [--window-id <window-id>] [--no-outer-gaps] [--fail-if-noop]
fullscreen [-h|--help] off [--window-id <window-id>] [--fail-if-noop]

Toggle AeroSpork fullscreen for the focused window.

fullscreen makes a window fill its monitor, in front of the other windows of the workspace. The window keeps the outer gaps, and the menu bar and the Dock stay. The window also keeps its place in the tree. This is AeroSpork fullscreen, not macOS fullscreen: no new Space opens. For macOS fullscreen, see macos-native-fullscreen.

When you focus another tiled window on the same workspace, the fullscreen window leaves fullscreen.

OPTIONS

-h, --help

Print help and exit.

--no-outer-gaps

Fill the monitor up to its edges, without the outer gaps. Incompatible with off.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Requires on or off.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

on

Make the window fullscreen.

off

Make the window leave fullscreen.

With neither argument, fullscreen toggles.

EXIT STATUS

The exit status follows the rules for every command.

fullscreen exits 1 when no window is focused. With --fail-if-noop, it also exits 1 when the window is already in the requested state.

EXAMPLES

  • Toggle fullscreen with a binding:

    [keys]
    alt-f = 'fullscreen'

SEE ALSO

aerospork(1), aerospork-macos-native-fullscreen(1), aerospork-layout(1)

4. Workspaces

4.1. workspace

workspace [-h|--help] [--auto-back-and-forth] [--fail-if-noop] <workspace>
workspace [-h|--help] [--wrap-around] (next|prev)

Focus a workspace.

workspace focuses <workspace>, and the window on it that had focus last. When no workspace has that name, AeroSpork creates it. An off-screen workspace appears on the monitor that the config pins it to, else on the monitor where it was visible last, else on the main monitor.

next and prev focus the next or the previous workspace in a list:

  • When stdin is not a terminal and holds more than white space, the list is the lines of stdin.

  • In every other case, the list is the workspaces of the focused monitor in name order, with numbers in numeric order. It includes the empty workspaces that the config declares.

A workspace that the config declares always exists. Any other workspace exists only while it has windows or is visible. For the details, see the guide.

OPTIONS

-h, --help

Print help and exit.

--wrap-around

With next or prev, go on from the last workspace to the first, and the reverse.

--auto-back-and-forth

When <workspace> is already focused, go to the previous workspace instead, as workspace-back-and-forth does. Incompatible with --fail-if-noop.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Incompatible with --auto-back-and-forth, next and prev.

ARGUMENTS

<workspace>

The name of the workspace to focus.

(next|prev)

The next or the previous workspace in the list.

EXIT STATUS

The exit status follows the rules for every command.

workspace next and workspace prev exit 1 when there is no next or previous workspace. With --fail-if-noop, workspace also exits 1 when <workspace> is already focused.

EXAMPLES

  • Go to the next workspace that has windows, on the focused monitor:
    aerospork list-workspaces --monitor focused --empty no | aerospork workspace next

  • Switch workspaces with bindings, and press the same key again to go back:

    [keys]
    alt-1 = 'workspace --auto-back-and-forth 1'
    alt-2 = 'workspace --auto-back-and-forth 2'

SEE ALSO

aerospork(1), aerospork-workspace-back-and-forth(1), aerospork-summon-workspace(1), aerospork-move-node-to-workspace(1), aerospork-list-workspaces(1)

4.2. workspace-back-and-forth

workspace-back-and-forth [-h|--help]

Focus the workspace that had focus before.

workspace-back-and-forth focuses the workspace that had focus before the focused one. Run it twice to go back to where you started.

Unlike focus-back-and-forth, it still works after you close windows, because a workspace keeps its name even when it is empty. It fails when there is no previous workspace yet, for example just after AeroSpork starts.

OPTIONS

-h, --help

Print help and exit.

EXIT STATUS

The exit status follows the rules for every command.

workspace-back-and-forth exits 1 when there is no previous workspace yet.

EXAMPLES

  • Go back and forth with one key:

    [keys]
    alt-tab = 'workspace-back-and-forth'

SEE ALSO

aerospork(1), aerospork-focus-back-and-forth(1), aerospork-workspace(1)

4.3. summon-workspace

summon-workspace [-h|--help] [--fail-if-noop] <workspace>

Bring a workspace to the focused monitor.

summon-workspace makes <workspace> the visible workspace of the focused monitor, and focuses it. workspace goes to the monitor of a workspace. summon-workspace brings the workspace to you.

When <workspace> is visible on another monitor, the two monitors swap workspaces, so nothing that was on the screen disappears. On one monitor, summon-workspace does the same as workspace.

The command fails for a workspace that the config pins to another monitor.

OPTIONS

-h, --help

Print help and exit.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr.

ARGUMENTS

<workspace>

The name of the workspace to bring.

EXIT STATUS

The exit status follows the rules for every command.

summon-workspace exits 1 for a workspace that is pinned to another monitor. With --fail-if-noop, it also exits 1 when the workspace is already visible on the focused monitor.

EXAMPLES

  • Bring workspace web to the monitor that you work on:
    aerospork summon-workspace web

SEE ALSO

aerospork(1), aerospork-workspace(1), aerospork-move-workspace-to-monitor(1)

5. Windows

5.1. close

close [-h|--help] [--quit-if-last-window] [--window-id <window-id>]

Close the focused window.

close closes a window as its close button does. The app can ask you to save first, so the window can stay open.

For the focused window, macOS already offers cmd-w, so you do not need this command in a binding. Use it from a script, or with --window-id to close a window that does not have focus.

OPTIONS

-h, --help

Print help and exit.

--quit-if-last-window

When the window is the last window of its app, quit the app.

--window-id <window-id>

Act on the specified window instead of the focused window

EXIT STATUS

The exit status follows the rules for every command.

close exits 1 on an empty workspace, and when the app does not quit.

EXAMPLES

  • Close every TextEdit window, on every monitor:
    aerospork list-windows --monitor all --app-bundle-id com.apple.TextEdit --format '%{window-id}' | xargs -n1 aerospork close --window-id

SEE ALSO

aerospork(1), aerospork-close-all-windows-but-current(1), aerospork-list-windows(1)

5.2. close-all-windows-but-current

close-all-windows-but-current [-h|--help] [--quit-if-last-window]

Close every window on the focused workspace except the focused one.

close-all-windows-but-current runs close on each other window of the focused workspace. Windows on other workspaces stay open. An app can ask you to save first, so some windows can stay open.

OPTIONS

-h, --help

Print help and exit.

--quit-if-last-window

When a window is the last window of its app, quit the app.

EXIT STATUS

The exit status follows the rules for every command.

The command exits 1 on an empty workspace, and when an app does not quit.

EXAMPLES

  • Keep only the focused window, in a binding:

    [keys]
    alt-shift-w = 'close-all-windows-but-current'

SEE ALSO

aerospork(1), aerospork-close(1)

5.3. macos-native-fullscreen

macos-native-fullscreen [-h|--help] [--window-id <window-id>]
macos-native-fullscreen [-h|--help] [--window-id <window-id>] [--fail-if-noop] on
macos-native-fullscreen [-h|--help] [--window-id <window-id>] [--fail-if-noop] off

Toggle macOS fullscreen for the focused window.

macos-native-fullscreen does what the green button of a window does: macOS moves the window to a fullscreen Space of its own. AeroSpork takes the window out of the tiles while it is fullscreen, and puts it back in its place when it leaves fullscreen.

To fill the monitor and keep the window on its workspace, use fullscreen instead.

macOS reports the fullscreen state with a delay. Two macos-native-fullscreen commands in quick succession can act on the old state, or flicker.

OPTIONS

-h, --help

Print help and exit.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Requires on or off.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

on

Make the window fullscreen.

off

Make the window leave fullscreen.

With neither argument, the command toggles.

EXIT STATUS

The exit status follows the rules for every command.

macos-native-fullscreen exits 1 when no window is focused. With --fail-if-noop, it also exits 1 when the window is already in the requested state.

EXAMPLES

  • Toggle macOS fullscreen with a binding:

    [keys]
    alt-shift-f = 'macos-native-fullscreen'

SEE ALSO

aerospork(1), aerospork-fullscreen(1), aerospork-macos-native-minimize(1)

5.4. macos-native-minimize

macos-native-minimize [-h|--help] [--window-id <window-id>]

Minimize the focused window.

macos-native-minimize minimizes a window to the Dock, as cmd-m does. AeroSpork takes the window out of the tiles, and puts it back in its place when it comes back.

A minimized window has no focus, so only --window-id can name one. With --window-id and a minimized window, the command brings the window back.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Act on the specified window instead of the focused window

EXIT STATUS

The exit status follows the rules for every command.

macos-native-minimize exits 1 when no window is focused.

EXAMPLES

  • Minimize a window, then bring it back:

    id=$(aerospork list-windows --focused --format '%{window-id}')
    aerospork macos-native-minimize
    aerospork macos-native-minimize --window-id "$id"

SEE ALSO

aerospork(1), aerospork-macos-native-fullscreen(1), aerospork-focus(1)

5.5. sticky

sticky [-h|--help]     [--window-id <window-id>]
sticky [-h|--help] on  [--window-id <window-id>] [--fail-if-noop]
sticky [-h|--help] off [--window-id <window-id>] [--fail-if-noop]

Keep a floating window on screen when its monitor switches workspace.

sticky makes a window follow the workspace that its monitor shows. When the monitor switches to another workspace, the window moves to that workspace and stays where it is on the screen, at its size. Use it for a video call, a picture-in-picture video or a music player that you want to see on every workspace.

A sticky window is a floating window. sticky on floats a tiled window first. The window stops being sticky when you move it with move-node-to-workspace or move-node-to-monitor, or when you tile it.

A minimized sticky window, or one of a hidden app, stays on the workspace where it was until it comes back. AeroSpork remembers which windows are sticky when it restarts.

OPTIONS

-h, --help

Print help and exit.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Requires on or off.

--window-id <window-id>

Act on the specified window instead of the focused window

ARGUMENTS

on

Make the window sticky.

off

Make the window stop being sticky. It stays floating on the workspace where it is.

With neither argument, sticky toggles.

EXIT STATUS

The exit status follows the rules for every command.

sticky exits 1 when no window is focused, and when on names a minimized window, a window in macOS fullscreen or a window of a hidden app. With --fail-if-noop, it also exits 1 when the window is already in the requested state.

EXAMPLES

  • Toggle sticky with a binding:

    [keys]
    alt-shift-s = 'sticky'
  • Make every picture-in-picture window sticky when it opens:

    [[on-window-detected]]
        if.window-title-regex-substring = '^picture.in.picture$'
        run = 'sticky on'

SEE ALSO

aerospork(1), aerospork-layout(1), aerospork-move-node-to-workspace(1), aerospork-move-node-to-monitor(1)

6. Binding modes

6.1. mode

mode [-h|--help] <binding-mode>

Switch to another binding mode.

mode makes the bindings of <binding-mode> the active bindings. The bindings of the previous mode do not work until you switch back, usually with mode main. For how binding modes work, see the guide.

OPTIONS

-h, --help

Print help and exit.

ARGUMENTS

<binding-mode>

The name of a binding mode in the config, for example main or service.

EXIT STATUS

The exit status follows the rules for every command.

mode exits 1 when the config has no binding mode with that name. The active mode then does not change.

EXAMPLES

  • Enter a service mode with one binding, and leave it with esc:

    [keys]
    alt-shift-semicolon = 'mode service'
    
    [keys.service]
    esc = ['reload-config', 'mode main']

SEE ALSO

aerospork(1), aerospork-list-modes(1), aerospork-trigger-binding(1)

6.2. trigger-binding

trigger-binding [-h|--help] <binding> --mode <binding-mode>

Run a binding as if you pressed its keys.

trigger-binding runs the commands of a binding without a key press. The binding mode does not have to be the active one.

To list the bindings of a mode, run aerospork config --get mode.main.binding --keys.

OPTIONS

-h, --help

Print help and exit.

--mode <binding-mode>

The binding mode that holds <binding>. Required.

ARGUMENTS

<binding>

The keys of the binding, in the key notation of the config, for example alt-tab.

EXIT STATUS

The exit status follows the rules for every command.

trigger-binding exits 1 when the mode or the binding does not exist, and when a command of the binding fails.

EXAMPLES

  • Run the alt-tab binding of the main mode:
    aerospork trigger-binding --mode main alt-tab

  • Run the first binding of the main mode, in alphabetical order:
    aerospork trigger-binding --mode main "$(aerospork config --get mode.main.binding --keys | head -1)"

SEE ALSO

aerospork(1), aerospork-mode(1), aerospork-config(1), aerospork-list-modes(1)

7. AeroSpork and the system

7.1. enable

enable [-h|--help] toggle
enable [-h|--help] on [--fail-if-noop]
enable [-h|--help] off [--fail-if-noop]

Enable or disable window management.

enable off stops window management: AeroSpork moves the windows of off-screen workspaces onto the screen and stops every binding. enable on starts window management again, in the main binding mode. The Pause tiling and Resume tiling items of the menu bar icon do the same.

While window management is off, AeroSpork rejects every other command, query commands included. Such a command exits 1 with the message server is disabled and doesn’t accept commands. -h, --help, -v and --version still work.

Warning
No binding works while window management is off, so a binding cannot run enable on. Run aerospork enable on from a terminal, or choose Resume tiling from the menu bar icon.

OPTIONS

-h, --help

Print help and exit.

--fail-if-noop

Exit 1 instead of 0 when the target is already in the requested state, so that a script can tell that nothing changed. Without the flag, a no-op exits 0 and still writes a note to stderr. Incompatible with toggle.

ARGUMENTS

on

Enable window management.

off

Disable window management.

toggle

Enable window management if it is off, and disable it if it is on.

EXIT STATUS

The exit status follows the rules for every command.

With --fail-if-noop, enable on exits 1 when window management is already on, and enable off exits 1 when it is already off.

EXAMPLES

  • Let a script pause tiling while it arranges windows itself:

    aerospork enable off
    # ...
    aerospork enable on

SEE ALSO

aerospork(1), aerospork-mode(1)

7.2. reload-config

reload-config [-h|--help] [--no-gui] [--dry-run]

Read the config again and apply it.

reload-config reads the config file again and applies it. You rarely need it: AeroSpork already reloads the config when the file changes, from an editor or from the Settings window.

When the config has errors, AeroSpork keeps the config that it runs now. The command prints the errors to stdout and opens an error window.

OPTIONS

-h, --help

Print help and exit.

--no-gui

Do not open the error window. Print the errors to stdout only.

--dry-run

Check the config and print its errors, but do not apply it.

EXIT STATUS

The exit status follows the rules for every command.

reload-config exits 1 when the config has errors.

EXAMPLES

  • Check the config from a script, with no window:
    aerospork reload-config --dry-run --no-gui && echo 'The config is valid'

  • Reload the config and go back to the main binding mode:

    [keys.service]
    esc = ['reload-config', 'mode main']

SEE ALSO

aerospork(1), aerospork-config(1), aerospork-open-settings(1)

7.3. open-settings

open-settings [-h|--help]

Open the Settings window.

open-settings opens the Settings window of AeroSpork and brings it to the front, even when another app is frontmost. It does the same as Settings… in the menu bar icon, cmd-comma while AeroSpork is frontmost, or opening AeroSpork.app again while it runs.

There is only one Settings window. When it is already open, the command brings that window to the front. AeroSpork never tiles the Settings window and never moves it to a workspace.

For the panes and how changes apply, see the guide.

OPTIONS

-h, --help

Print help and exit.

EXIT STATUS

The exit status follows the rules for every command.

open-settings exits 1 when the window does not open.

EXAMPLES

  • Open the Settings window with a binding:

    [keys]
    alt-shift-comma = 'open-settings'

SEE ALSO

aerospork(1), aerospork-config(1), aerospork-reload-config(1)

7.4. exec-and-forget

exec-and-forget <bash-script>   # config only, not available in CLI

Run a shell script in the background, from the config.

exec-and-forget runs /bin/bash -c '<bash-script>' and does not wait for it. AeroSpork ignores the stdout, the stderr and the exit code of the script.

This command works only in the config, in a binding or a callback. From a shell, run the script directly.

The script inherits the full environment of AeroSpork, secrets included: API tokens, credentials, and anything that your shell profile exported when AeroSpork started. That is deliberate, because a script that posts to Slack needs its token. It also means that the config is trusted input.

Warning
Read every exec-and-forget line that you copy from the internet before you put it in your config. The script runs as you, with your secrets. Treat it as a line that you are about to paste into your shell.

AeroSpork adds these variables to the environment:

  • AEROSPORK_WINDOW_ID: the target window, when the command has one.

  • AEROSPORK_WORKSPACE: the target workspace, when the command has one.

  • AEROSPORK_FOCUSED_WORKSPACE: in on-focused-workspace-changed, the workspace that now has focus.

  • AEROSPORK_PREV_WORKSPACE: in on-focused-workspace-changed, the workspace that had focus before.

  • AEROSPORK_MODE: in on-mode-changed, the binding mode that is now active.

  • AEROSPORK_PREV_MODE: in on-mode-changed, the binding mode that was active before.

To start from an empty environment, set inherit-env-vars = false in [exec]. To list the variables that the script receives, set env-vars in [exec]. aerospork list-exec-env-vars prints the environment that every such script starts from. It hides secret-looking values on screen, but the script still receives them.

ARGUMENTS

<bash-script>

The rest of the TOML string after `exec-and-forget `. AeroSpork passes it to bash as it is, with no parsing and no escaping.

EXIT STATUS

The exit status follows the rules for every command.

exec-and-forget exits 1 only when bash does not start. The exit code of the script does not count.

EXAMPLES

  • Open a new Terminal window with a binding:

    [keys]
    alt-enter = 'exec-and-forget open -n /System/Applications/Utilities/Terminal.app'

SEE ALSO

aerospork(1), aerospork-list-exec-env-vars(1), the guide on exec environment variables

7.5. volume

volume [-h|--help] (up|down)
volume [-h|--help] (mute-toggle|mute-off|mute-on)
volume [-h|--help] set <number>

Change or mute the system output volume.

volume changes the output volume of the Mac, as the volume keys do. Bind it to keys on a keyboard that has no media keys.

OPTIONS

-h, --help

Print help and exit.

ARGUMENTS

up, down

Make the volume louder or quieter by one step of 6.25% (1/16), the step of the media keys.

mute-toggle

Mute the output, or unmute it when it is muted.

mute-on

Mute the output.

mute-off

Unmute the output.

set <number>

Set the volume to <number>, from 0 to 100.

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Set the volume to one quarter:
    aerospork volume set 25

  • Control the volume with bindings:

    [keys]
    alt-shift-up = 'volume up'
    alt-shift-down = 'volume down'
    alt-shift-m = 'volume mute-toggle'

SEE ALSO

aerospork(1)

7.6. debug-log

debug-log [-h|--help] (on|off|toggle)

Turn verbose tracing on or off in the running app.

debug-log on makes AeroSpork trace every refresh and every command to the unified log, at once and with no restart. debug-log off stops the trace. AeroSpork writes the trace at debug level, which the unified log does not keep: only a log stream --debug that already runs receives it. Verbose tracing in the guide has the steps.

Each switch writes Verbose tracing: on or Verbose tracing: off to the config log category, which log show finds later. The setting lasts until AeroSpork quits. To trace from launch, set AEROSPORK_DEBUG_LOG in the environment of the app instead.

OPTIONS

-h, --help

Print help and exit.

ARGUMENTS

on

Start the trace.

off

Stop the trace.

toggle

Start the trace if it is off, and stop it if it is on.

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Trace one reproduction of a problem:

    aerospork debug-log on
    log stream --debug --predicate 'subsystem == "com.wbs.aerospork"' > aerospork-trace.log
    # reproduce the problem, then Control-C
    aerospork debug-log off

SEE ALSO

aerospork(1), aerospork-debug-windows(1)

8. Query commands

Query commands print the state of AeroSpork and change nothing. They work only from the CLI, because a binding or a callback has no way to use their output. list-exec-env-vars is the exception: it also works in the config, so a callback can print its own environment.

8.1. config

config [-h|--help] --get <name> [--json] [--keys]
config [-h|--help] --major-keys
config [-h|--help] --all-keys
config [-h|--help] --config-path

Print values from the config that AeroSpork runs.

config prints the effective config: what AeroSpork runs now, after it expands the file. For example, --get mode.main.binding lists the generated bindings and the bindings that you wrote.

The config is a tree of maps, arrays, strings and integers. Without --json or --keys, --get prints only a string, an integer or an array of them. For a map or an array of maps, add --json or --keys.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

AeroSpork reads its config from ~/.aerospork.toml or $XDG_CONFIG_HOME/aerospork/aerospork.toml. When XDG_CONFIG_HOME is not set, the second path is ~/.config/aerospork/aerospork.toml. When both files exist, AeroSpork reports a config error. A debug build reads ~/.aerospork-debug.toml or $XDG_CONFIG_HOME/aerospork/aerospork-debug.toml. When you start AeroSpork.app with --config-path <path>, it reads that file instead.

aerospork config --config-path prints the path of the file that the running app loaded. When you have no config of your own, that is the default config inside the app.

For the v1 and v2 spellings of the config, and how AeroSpork converts a v1 config, see the guide.

OPTIONS

-h, --help

Print help and exit.

--get <name>

Print the value of <name>. --major-keys and --all-keys list the names.

--major-keys

Print the top-level names.

--all-keys

Print every name, at every level.

--json

Print the value as JSON. Requires --get.

--keys

Print the keys of a map, or the indexes of an array. Requires --get.

--config-path

Print the absolute path of the config that the running app loaded.

EXIT STATUS

The exit status follows the rules for every command.

config --get exits 1 when <name> is not in the config.

EXAMPLES

  • Print the path of the config that AeroSpork loaded:

    $ aerospork config --config-path
    /Users/you/.aerospork.toml
  • List the binding modes:

    $ aerospork config --get mode --keys
    main
    service
  • List the bindings of the main binding mode:

    $ aerospork config --get mode.main.binding --keys
    alt-1
    alt-2
    ...
  • Print the bindings of the main binding mode as JSON:

    $ aerospork config --get mode.main.binding --json
    {
      "alt-1" : "workspace 1",
      "alt-shift-1" : "move-node-to-workspace 1",
    ...

SEE ALSO

aerospork(1), aerospork-reload-config(1), aerospork-list-modes(1), aerospork-open-settings(1)

8.2. debug-windows

debug-windows [-h|--help] [--window-id <window-id>]
debug-windows [-h|--help] --tree

Record what macOS reports about windows, for a bug report.

debug-windows records what the macOS Accessibility API reports about windows. Attach its output to a bug report about a window that AeroSpork handles wrongly, for example a window that floats when it should tile.

To record a session:

  1. Run aerospork debug-windows. The recording starts.

  2. Focus the problem window, or make the window appear.

  3. Run aerospork debug-windows again. The recording stops and the command prints what it recorded.

debug-windows --tree prints, as JSON, what AeroSpork holds: each monitor and the workspace it shows, the tree of each workspace with its windows and the windows that macOS took out of the tiles, each app, and a list of the inconsistencies it found. The dump reads only AeroSpork’s own state and asks no app anything. Like every command, it still waits its turn behind a command already running, so an app that does not answer can delay the reply but not stop it.

debug-windows is not a stable API. Do not rely on the command, or on its output format, in a script.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--window-id <window-id>

Print the information for this window at once, with no recording session.

--tree

Print the state of AeroSpork as JSON, with no recording session.

EXIT STATUS

The exit status follows the rules for every command.

debug-windows --window-id exits 1 when no window has that ID.

EXAMPLES

  • Save the information for one window to a file:
    aerospork debug-windows --window-id 1234 > window.txt

  • Save the state of AeroSpork to a file:
    aerospork debug-windows --tree > tree.json

SEE ALSO

aerospork(1), aerospork-list-windows(1)

8.3. list-apps

list-apps [-h|--help] [--macos-native-hidden [no]] [--format <output-format>] [--count] [--json]

Print the running apps that can have windows.

list-apps prints the running apps that appear in the Dock and can have a user interface, one line for each app. Use it to find the bundle ID of an app for a window rule.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--macos-native-hidden [no]

Print only the apps hidden with cmd-h. With no, print only the apps that are not hidden.

--format <output-format>

Print each item in <output-format>. See the Output format section. Incompatible with --count.

--count

Print only the number of apps. Incompatible with --format and --json.

--json

Print the result as JSON. With --format, <output-format> chooses the fields of each JSON object. It can then hold only variables and spaces: AeroSpork rejects %{right-padding} and literal text. Incompatible with --count.

OUTPUT FORMAT

--format <output-format> sets the output format. <output-format> is a template: AeroSpork replaces each %{variable} in it with a value and keeps the other text. A value can come from an app, such as a window title, so AeroSpork prints each control character in it, tab and newline included, as � (U+FFFD). A title cannot then move the cursor of your terminal or add a line to the output. %{tab} and %{newline} still print a real tab and newline, and --json escapes the characters instead.

The default <output-format> is
%{app-pid}%{right-padding} | %{app-bundle-id}%{right-padding} | %{app-name}

<output-format> can use these variables:

%{app-bundle-id}

String. The bundle ID of the app.

%{app-name}

String. The app name.

%{app-pid}

Number. The process ID of the app.

%{app-exec-path}

String. The path of the app executable.

%{app-bundle-path}

String. The path of the app bundle.

%{right-padding}

The number of spaces that aligns the current column.

%{newline}

A newline character (U+000A, \n).

%{tab}

A tab character (U+0009, \t).

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Print the bundle ID and the name of every app:
    aerospork list-apps --format '%{app-bundle-id}%{right-padding} %{app-name}'

  • Count the hidden apps:
    aerospork list-apps --macos-native-hidden --count

SEE ALSO

aerospork(1), aerospork-list-windows(1)

8.4. list-exec-env-vars

list-exec-env-vars [-h|--help] [--show-secrets]

Print the environment that exec-* commands and callbacks run with.

list-exec-env-vars prints the environment that each of these starts from, one NAME=value line for each variable:

  • The exec-and-forget command.

  • The on-focus-changed, on-focused-workspace-changed, on-focused-monitor-changed and on-mode-changed callbacks.

AeroSpork adds AEROSPORK_WINDOW_ID, AEROSPORK_WORKSPACE, AEROSPORK_FOCUSED_WORKSPACE, AEROSPORK_PREV_WORKSPACE, AEROSPORK_MODE and AEROSPORK_PREV_MODE for each command, from what triggered it. Those variables are not in this list.

By default, the command hides the value of each variable whose name looks like a secret: a name that contains KEY, TOKEN, SECRET, PASSWORD, PASSWD, CREDENTIAL, AUTH or PRIVATE. The match is deliberately broad. A value that is hidden for no reason costs you one flag. A leaked credential costs you the credential.

The hiding is for the screen only. The script still receives the real values, because a script that posts to Slack needs its token. See aerospork-exec-and-forget(1).

Unlike the other query commands, list-exec-env-vars also works in the config, so a callback can print its own environment.

OPTIONS

-h, --help

Print help and exit.

--show-secrets

Print the real values in place of <redacted>.

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Check the PATH that a script gets:
    aerospork list-exec-env-vars | grep '^PATH='

SEE ALSO

aerospork(1), aerospork-exec-and-forget(1), the guide on exec environment variables

8.5. list-modes

list-modes [-h|--help] [--current] [--json]

Print the binding modes of the config.

list-modes prints the name of each binding mode in the config, one name for each line. For how binding modes work, see the guide.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--current

Print only the active binding mode.

--json

Print the names as a JSON array of strings.

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Show the active binding mode in a status bar:
    aerospork list-modes --current

  • Read the binding modes from a script:
    aerospork list-modes --json

SEE ALSO

aerospork(1), aerospork-mode(1), aerospork-trigger-binding(1)

8.6. list-monitors

list-monitors [-h|--help] [--focused [no]] [--mouse [no]] [--format <output-format>] [--count] [--json]

Print the connected monitors.

list-monitors prints one line for each connected monitor, in monitor order. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom. The filters narrow the list.

Use --format '%{monitor-fingerprint}' to get the table that pins a workspace to one physical monitor in [monitors].

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--focused [no]

Print only the focused monitor. With no, print every other monitor.

--mouse [no]

Print only the monitor with the mouse pointer. With no, print every other monitor.

--format <output-format>

Print each item in <output-format>. See the Output format section. Incompatible with --count.

--count

Print only the number of monitors. Incompatible with --format and --json.

--json

Print the result as JSON. With --format, <output-format> chooses the fields of each JSON object. It can then hold only variables and spaces: AeroSpork rejects %{right-padding} and literal text. Incompatible with --count.

OUTPUT FORMAT

--format <output-format> sets the output format. <output-format> is a template: AeroSpork replaces each %{variable} in it with a value and keeps the other text. A value can come from an app, such as a window title, so AeroSpork prints each control character in it, tab and newline included, as � (U+FFFD). A title cannot then move the cursor of your terminal or add a line to the output. %{tab} and %{newline} still print a real tab and newline, and --json escapes the characters instead.

The default <output-format> is
%{monitor-id}%{right-padding} | %{monitor-name}

<output-format> can use these variables:

%{monitor-id}

Number. The monitor number, from 1. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

%{monitor-appkit-nsscreen-screens-id}

Number. The position of the monitor in the NSScreen.screens array, from 1. Tools such as sketchybar use this order.

%{monitor-name}

String. The monitor name.

%{monitor-fingerprint}

String. The hardware fingerprint of the monitor: the vendor, model, serial, name, size and UUID that the display reports, as a table that you can paste into [monitors]. Use it to pin a workspace to one physical monitor in a docking setup.

%{monitor-vendor-id}

String. The vendor ID of the monitor in hexadecimal, for example 0x10AC. Empty if the display does not report it.

%{monitor-model-id}

String. The model ID of the monitor in hexadecimal, for example 0xD0C1. Empty if the display does not report it.

%{monitor-serial-number}

String. The serial number of the monitor. Empty if the display does not report it.

%{monitor-uuid}

String. The UUID that macOS gives the display, for example 37D8832A-2D66-02CA-B9F7-8F30A301B230. It stays the same across restarts and is the only key that tells two DisplayLink panels apart: pin a workspace to one with 1 = { uuid = "…​" } in [monitors]. Empty if the display does not report one.

%{monitor-width}

Number. The width of the monitor in points.

%{monitor-height}

Number. The height of the monitor in points.

%{right-padding}

The number of spaces that aligns the current column.

%{newline}

A newline character (U+000A, \n).

%{tab}

A tab character (U+0009, \t).

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Print every monitor in the default format:
    aerospork list-monitors

  • Print the monitor fingerprints, to paste into [monitors]:
    aerospork list-monitors --format '%{monitor-fingerprint}'

  • Print the vendor ID, the model ID and the size of each monitor:
    aerospork list-monitors --format '%{monitor-name} [%{monitor-vendor-id}:%{monitor-model-id}] %{monitor-width}x%{monitor-height}'

SEE ALSO

aerospork(1), aerospork-focus-monitor(1), aerospork-list-workspaces(1), the guide on how to pin workspaces to monitors

8.7. list-windows

list-windows [-h|--help] (--workspace <workspace>...|--monitor <monitor>...)
             [--monitor <monitor>...] [--workspace <workspace>...]
             [--pid <pid>] [--app-bundle-id <app-bundle-id>] [--format <output-format>]
             [--count] [--json]
list-windows [-h|--help] --all [--format <output-format>] [--count] [--json]
list-windows [-h|--help] --focused [--format <output-format>] [--count] [--json]
list-windows [-h|--help] --scratchpad [--pid <pid>] [--app-bundle-id <app-bundle-id>]
             [--format <output-format>] [--count] [--json]

Print the windows that match the filters.

list-windows prints one line for each window that matches every filter. Give at least one of --workspace, --monitor, --all, --focused and --scratchpad. --all and --focused take no other filter. A scratchpad window that is put away belongs to no workspace, so only --scratchpad lists it.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--all

Alias for --monitor all.

On more than one monitor, --monitor focused is almost always what you want. A script that acts on all monitors also acts on workspaces and windows that you do not see.

--focused

Print the focused window. When no window has focus, the command exits 1.

--scratchpad

Print the scratchpad windows, put away or shown. A window that is put away has no workspace and no monitor: %{workspace} prints NULL-WORKSPACE for it. --pid and --app-bundle-id can narrow the list.

--workspace <workspace>…​

Print only the windows on the given workspaces. <workspace>…​ is a space-separated list of:

  • A workspace name.

  • focused: the focused workspace.

  • visible: every visible workspace, one for each monitor.

--monitor <monitor>…​

Print only the workspaces or windows on the given monitors. <monitor>…​ is a space-separated list of monitor IDs:

  • A monitor number. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

  • all: every monitor.

  • mouse: the monitor with the mouse pointer.

  • focused: the focused monitor.

--pid <pid>

Print only the windows of the app with this process ID.

--app-bundle-id <app-bundle-id>

Print only the windows of the app with this bundle ID.

Old spelling, still accepted: --app-id.

--format <output-format>

Print each item in <output-format>. See the Output format section. Incompatible with --count.

--count

Print only the number of windows. Incompatible with --format and --json.

--json

Print the result as JSON. With --format, <output-format> chooses the fields of each JSON object. It can then hold only variables and spaces: AeroSpork rejects %{right-padding} and literal text. Incompatible with --count.

OUTPUT FORMAT

--format <output-format> sets the output format. <output-format> is a template: AeroSpork replaces each %{variable} in it with a value and keeps the other text. A value can come from an app, such as a window title, so AeroSpork prints each control character in it, tab and newline included, as � (U+FFFD). A title cannot then move the cursor of your terminal or add a line to the output. %{tab} and %{newline} still print a real tab and newline, and --json escapes the characters instead.

The default <output-format> is
%{window-id}%{right-padding} | %{app-name}%{right-padding} | %{window-title}

<output-format> can use these variables:

%{window-id}

Number. The unique ID of the window.

%{window-title}

String. The window title.

%{window-is-fullscreen}

Boolean. True if aerospork fullscreen made the window fullscreen.

%{window-is-sticky}

Boolean. True if aerospork sticky made the window follow the workspace that its monitor shows.

%{window-is-floating}

Boolean. True if the window floats instead of taking a tile.

%{window-layout}

String. tiles or accordion, the layout of the container that the window is tiled in, or floating. Empty for a window that macOS minimized, hid or made fullscreen.

%{window-orientation}

String. horizontal or vertical, the orientation of the container that the window is tiled in. Empty for a window that is not tiled.

%{window-is-scratchpad}

Boolean. True if aerospork move-node-to-scratchpad put the window in the scratchpad, whether it is put away or shown.

%{window-x}

Number. The distance in points from the left edge of the main monitor to the left edge of the window, negative on a monitor to its left. A tiled window reports its tile, which AeroSpork already knows. Any other window costs one read from its app, made only when the format names %{window-x}, %{window-y}, %{window-width} or %{window-height}. All four are empty, and null in JSON, for a window that is not on screen: on a workspace that is not visible, hidden with its app, or put away in the scratchpad.

%{window-y}

Number. The distance in points from the top edge of the main monitor to the top edge of the window, negative on a monitor above it. Empty for a window that is not on screen.

%{window-width}

Number. The width of the window in points. Empty for a window that is not on screen.

%{window-height}

Number. The height of the window in points. Empty for a window that is not on screen.

%{app-bundle-id}

String. The bundle ID of the app.

%{app-name}

String. The app name.

%{app-pid}

Number. The process ID of the app.

%{app-exec-path}

String. The path of the app executable.

%{app-bundle-path}

String. The path of the app bundle.

%{workspace}

String. The workspace name.

%{workspace-is-focused}

Boolean. True if the workspace is the focused workspace.

%{workspace-is-visible}

Boolean. True if the workspace is visible. On more than one monitor, a workspace can be visible but not focused.

%{monitor-id}

Number. The monitor number, from 1. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

%{monitor-appkit-nsscreen-screens-id}

Number. The position of the monitor in the NSScreen.screens array, from 1. Tools such as sketchybar use this order.

%{monitor-name}

String. The monitor name.

%{monitor-fingerprint}

String. The hardware fingerprint of the monitor: the vendor, model, serial, name, size and UUID that the display reports, as a table that you can paste into [monitors]. Use it to pin a workspace to one physical monitor in a docking setup.

%{monitor-vendor-id}

String. The vendor ID of the monitor in hexadecimal, for example 0x10AC. Empty if the display does not report it.

%{monitor-model-id}

String. The model ID of the monitor in hexadecimal, for example 0xD0C1. Empty if the display does not report it.

%{monitor-serial-number}

String. The serial number of the monitor. Empty if the display does not report it.

%{monitor-uuid}

String. The UUID that macOS gives the display, for example 37D8832A-2D66-02CA-B9F7-8F30A301B230. It stays the same across restarts and is the only key that tells two DisplayLink panels apart: pin a workspace to one with 1 = { uuid = "…​" } in [monitors]. Empty if the display does not report one.

%{monitor-width}

Number. The width of the monitor in points.

%{monitor-height}

Number. The height of the monitor in points.

%{right-padding}

The number of spaces that aligns the current column.

%{newline}

A newline character (U+000A, \n).

%{tab}

A tab character (U+0009, \t).

EXIT STATUS

The exit status follows the rules for every command.

list-windows --focused exits 1 when no window has focus.

EXAMPLES

  • Print the windows of the focused workspace:
    aerospork list-windows --workspace focused

  • Print the ID of the focused window:
    aerospork list-windows --focused --format '%{window-id}'

  • Count the Safari windows on every monitor:
    aerospork list-windows --monitor all --app-bundle-id com.apple.Safari --count

  • Print the scratchpad windows, with the workspace that shows each one:
    aerospork list-windows --scratchpad --format '%{window-id} %{app-name} %{workspace}'

  • Print the frame of each window on the focused workspace:
    aerospork list-windows --workspace focused --format '%{window-id} %{window-x} %{window-y} %{window-width} %{window-height}'

  • Print every window as JSON, with its workspace:
    aerospork list-windows --all --json --format '%{window-id} %{app-name} %{window-title} %{workspace}'

SEE ALSO

aerospork(1), aerospork-list-apps(1), aerospork-list-workspaces(1), aerospork-focus(1)

8.8. list-workspaces

list-workspaces [-h|--help] --monitor <monitor>... [--visible [no]] [--empty [no]] [--format <output-format>] [--count] [--json]
list-workspaces [-h|--help] --all [--format <output-format>] [--count] [--json]
list-workspaces [-h|--help] --focused [--format <output-format>] [--count] [--json]

Print the workspaces that match the filters.

list-workspaces prints the name of each workspace that matches every filter, one name for each line. Give one of --monitor, --all and --focused.

A workspace that the config declares always exists, even while it is empty, so --all always prints it. For which workspaces exist, see the guide.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--all

Alias for --monitor all.

On more than one monitor, --monitor focused is almost always what you want. A script that acts on all monitors also acts on workspaces and windows that you do not see.

--focused

Alias for --monitor focused --visible. Always prints one workspace.

--monitor <monitor>…​

Print only the workspaces or windows on the given monitors. <monitor>…​ is a space-separated list of monitor IDs:

  • A monitor number. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

  • all: every monitor.

  • mouse: the monitor with the mouse pointer.

  • focused: the focused monitor.

--visible [no]

Print only the visible workspaces, one for each monitor. With no, print only the workspaces that are off screen.

--empty [no]

Print only the empty workspaces. With no, print only the workspaces that have windows.

--format <output-format>

Print each item in <output-format>. See the Output format section. Incompatible with --count.

--count

Print only the number of workspaces. Incompatible with --format and --json.

--json

Print the result as JSON. With --format, <output-format> chooses the fields of each JSON object. It can then hold only variables and spaces: AeroSpork rejects %{right-padding} and literal text. Incompatible with --count.

OUTPUT FORMAT

--format <output-format> sets the output format. <output-format> is a template: AeroSpork replaces each %{variable} in it with a value and keeps the other text. A value can come from an app, such as a window title, so AeroSpork prints each control character in it, tab and newline included, as � (U+FFFD). A title cannot then move the cursor of your terminal or add a line to the output. %{tab} and %{newline} still print a real tab and newline, and --json escapes the characters instead.

The default <output-format> is %{workspace}.

<output-format> can use these variables:

%{workspace}

String. The workspace name.

%{workspace-is-focused}

Boolean. True if the workspace is the focused workspace.

%{workspace-is-visible}

Boolean. True if the workspace is visible. On more than one monitor, a workspace can be visible but not focused.

%{monitor-id}

Number. The monitor number, from 1. AeroSpork numbers the monitors from 1 by their left edge, from left to right. It numbers monitors with the same left edge from top to bottom.

%{monitor-appkit-nsscreen-screens-id}

Number. The position of the monitor in the NSScreen.screens array, from 1. Tools such as sketchybar use this order.

%{monitor-name}

String. The monitor name.

%{monitor-fingerprint}

String. The hardware fingerprint of the monitor: the vendor, model, serial, name, size and UUID that the display reports, as a table that you can paste into [monitors]. Use it to pin a workspace to one physical monitor in a docking setup.

%{monitor-vendor-id}

String. The vendor ID of the monitor in hexadecimal, for example 0x10AC. Empty if the display does not report it.

%{monitor-model-id}

String. The model ID of the monitor in hexadecimal, for example 0xD0C1. Empty if the display does not report it.

%{monitor-serial-number}

String. The serial number of the monitor. Empty if the display does not report it.

%{monitor-uuid}

String. The UUID that macOS gives the display, for example 37D8832A-2D66-02CA-B9F7-8F30A301B230. It stays the same across restarts and is the only key that tells two DisplayLink panels apart: pin a workspace to one with 1 = { uuid = "…​" } in [monitors]. Empty if the display does not report one.

%{monitor-width}

Number. The width of the monitor in points.

%{monitor-height}

Number. The height of the monitor in points.

%{right-padding}

The number of spaces that aligns the current column.

%{newline}

A newline character (U+000A, \n).

%{tab}

A tab character (U+0009, \t).

EXIT STATUS

The exit status follows the rules for every command.

EXAMPLES

  • Print the focused workspace:
    aerospork list-workspaces --focused

  • Print the workspaces with windows on the focused monitor:
    aerospork list-workspaces --monitor focused --empty no

  • Print each workspace with the monitor that it is on:
    aerospork list-workspaces --all --format '%{workspace}%{right-padding} %{monitor-name}'

SEE ALSO

aerospork(1), aerospork-workspace(1), aerospork-list-windows(1), aerospork-list-monitors(1)

8.9. subscribe

subscribe [-h|--help] --all
subscribe [-h|--help] <event>...

Print a JSON line for each event, until interrupted.

subscribe prints the current state as one line of JSON, then one line of JSON for each event that happens, until you interrupt it. A status bar reads the lines as they come, instead of starting a process for each change.

This command works only from the CLI. A binding or a callback cannot use its output, so the config rejects it.

OPTIONS

-h, --help

Print help and exit.

--all

Print every event.

ARGUMENTS

<event>…​

The events to print: one or more of focus-changed, focused-workspace-changed, focused-monitor-changed, mode-changed, window-detected, workspace-windows-changed and window-layout-changed.

OUTPUT

Each line is one JSON object. Its event field names it, and its version field is 1. The version changes only when a field changes in a way that breaks a reader, so check it before you read the other fields. A field can be added to an event in the same version, and so can a new event, which --all prints: skip a field or an event that you do not know. Fields that name a monitor, a window or a mode are null when there is none. monitor-id counts from 1, like %{monitor-id} in aerospork-list-monitors(1).

The first line is always the snapshot:

snapshot

mode (the active binding mode), focused-workspace, focused-window-id, focused-monitor-id, monitors (one object for each monitor: monitor-id, monitor-name, and workspace, the workspace it shows), and workspaces (one object for each workspace: workspace, monitor-id and windows).

windows, here and in workspace-windows-changed, is a list of objects sorted by window-id, each with window-id, app-name and app-bundle-id. It holds the windows that aerospork list-windows --workspace <name> lists. A minimized window belongs to no workspace.

The events that follow:

focus-changed

The focused window changed, or focus moved to an empty workspace. Fields: window-id, workspace.

focused-workspace-changed

Fields: workspace, prev-workspace.

focused-monitor-changed

Fields: monitor-id, prev-monitor-id, workspace (the focused workspace).

mode-changed

Fields: mode, prev-mode.

window-detected

AeroSpork saw a new window, after the on-window-detected rules ran. Fields: window-id, app-name, app-bundle-id, workspace (where the rules left it).

workspace-windows-changed

A window came to or left a workspace: it opened, closed, moved or was minimized. One event for each workspace that changed. Fields: workspace, windows (all the windows the workspace has now).

window-layout-changed

A window on a workspace changed its layout: it was tiled or floated, made sticky or not, or its container changed layout or orientation. One event for each window that changed. A window that opens, closes or moves to another workspace with the same layout sends none. Fields: window-id, workspace, and the values that aerospork list-windows prints for %{window-layout}, %{window-orientation}, %{window-is-floating} and %{window-is-sticky}, under those names: window-layout, window-orientation, window-is-floating and window-is-sticky.

The focus events fire when the on-focus-changed, on-focused-workspace-changed and on-focused-monitor-changed callbacks would. mode-changed fires on every change of binding mode, including one that an on-mode-changed callback makes, which does not run that callback again. They do not depend on whether the config sets those callbacks.

AeroSpork keeps up to 16 subscribers. A subscriber that stops reading is dropped, not waited on: read the lines as they come.

EXIT STATUS

subscribe runs until you interrupt it, or until AeroSpork ends the stream:

1

Window management was off when you subscribed, it was turned off with aerospork enable off, or 16 subscribers were already connected. The reason is on stderr.

2

An unknown event or flag.

3

AeroSpork is not running, it quit, or it dropped this subscriber because it stopped reading. Start subscribe again to get a new snapshot.

EXAMPLES

  • Update a status bar’s workspace list when windows come and go:
    aerospork subscribe focused-workspace-changed workspace-windows-changed

  • Watch every event:
    aerospork subscribe --all

  • Print the name of each workspace you go to:
    aerospork subscribe focused-workspace-changed | jq --unbuffered -r 'select(.event != "snapshot") | .workspace'

SEE ALSO

aerospork(1), aerospork-list-windows(1), aerospork-list-workspaces(1), aerospork-mode(1)

9. Exit status

The aerospork CLI exits with one of four codes, so that a script can tell the kind of failure:

0

The command did what you asked. A no-op also exits 0. See --fail-if-noop on the commands that take it.

1

The command ran and failed: no window to act on, an unknown target, or window management is off. The reason is on stderr.

2

AeroSpork did not understand the command: an unknown subcommand, flag or value. The error on stderr names what the command accepts.

3

The CLI cannot reach AeroSpork, or AeroSpork did not answer within 60 seconds. Open AeroSpork.app, then run the command again. If AeroSpork is running and does not answer, quit it and open it again.