mdctl activate
Switch the machine to a group.
mdctl activate <name> Arguments
| Argument | Type | Required | Meaning |
|---|---|---|---|
| name | string | Yes | The group to switch to, matched by name. |
What it prints
One line naming the group that was activated.
Creates the displays the group describes, puts every display the group positions into the mode it recorded, applies the arrangement, and sets the main display.
mdctl activate Office
Activated "Office". One name, matched exactly
No fuzzy matching and no partial match. mdctl list prints the names in exactly the form this
command expects, one per line, ready to be copied. Quote anything with a space in it.
mdctl activate 'MacBook Air 13-inch (M1)'
Activated "MacBook Air 13-inch (M1)". A group whose name begins with a dash is still reachable: -- ends option parsing.
mdctl activate Grading
mdctl: no group named "Grading" What happens if it fails halfway
Activation is a transaction. If a display cannot be created, or the layout will not settle, the previous state comes back and the command exits 1. If restoring the previous state fails too, the app releases every virtual display and puts a physical one back as main.
The machine is never left with nothing on screen. That is the invariant the whole design is built around, and it has a test behind it.
Exit codes
The same four across every command, so a script can branch on the number without knowing which command produced it.
| Code | Name | When |
|---|---|---|
| 0 | ok | The command succeeded. |
| 1 | commandFailed | The app understood the command and refused or failed it. The reason is on stderr. |
| 2 | usage | The arguments were wrong. Nothing was sent. |
| 3 | appNotRunning | No app is listening on the socket. |