How to pin Codex custom status line items to the edges with justify
The Codex CLI can show a custom status line in its footer, drawn by an MCP server (an experimental feature). Starting with 0.173.0 (December 2), a status line row accepts justify, so you can pin items to the left, center, or right, or spread them to both edges. Before, you could only set a fixed gap, so right-hand items drifted off the edge when the terminal was resized.
- Build a provider. Copy the create-statusline sample (
statusline.py) from the openai/codex repo and editrender. This example keeps the model name on the left and the agent state at the right edge.
def render(state):
thread = state.get("thread", {})
model = thread.get("model", {}).get("display_name") or "Codex"
agent = thread.get("agent", {}).get("state") or ""
return {
"type": "row",
"props": {"gap": 1, "justify": "between"},
"children": [
{"type": "text", "props": {"color": "status-model"}, "children": [model]},
{"type": "text", "children": [agent]},
],
}
- Register the provider as an MCP server.
codex mcp add my-statusline -- python3 -u /absolute/path/to/statusline.py
- Turn on Custom status line in
/experimentaland restart the TUI. In a new conversation, open/statusline, choose Choose a status line provider, and pick yours.
justify takes four values. start packs items at the left with the configured gap; center and end group them in the middle or at the right; between spreads spare columns across the gaps so items reach both edges. Only the root row gets the full footer width; nested rows take their content width. With justify set, adjacent bare strings merge into one item, so wrap anything you want positioned on its own in a separate text or row. An unsupported property invalidates the whole response, so a provider meant for several versions should check app.cli_version in the state and add justify only on 0.173.0 or later.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.