VCode home

The back button closes what is open

Agents: claude, codex, opencode · On: phone, desktop

The phone's back button closes the top open layer (a sheet, a drawer, a viewer, the shell) one press at a time. With nothing open it leaves the app as it always did. On a keyboard, Escape or Ctrl+W (⌘W on a Mac) closes the same stack.

Why you would use it

On Android, back is the gesture you already use to dismiss things. Without this, back from an open diff sheet would quit an installed app and lose your place.

How to use it

Press back. Press it again for the next layer down. Or press Escape, wherever the cursor is.

The new-thread card open over the new-thread page, two layers deep.

One press closes the card. The page under it is still there.

The card gone, the new-thread page still open behind it.

What you see

Each press closes the topmost of these, in this order:

  1. the phone's keyboard. With the keyboard up over the tab drawer or a sheet, the first back hides the keyboard and the drawer stays; the next back closes the drawer. Over a line's comment box the first back closes the box, keyboard and all, and the file stays open.
  2. an open screenshot (#shotview); see inline-screenshots
  3. the file viewer (#viewer); see file-viewer
  4. the diff sheet (#review); see diff-review-sheet
  5. the new-thread card (#newthread). With the keyboard up the phone's back hides the keyboard, and that closes the card too, folder list and all.
  6. the settings sheet (#settings)
  7. the Threads sheet (#sessions)
  8. the tab drawer (#drawer)
  9. the file explorer (#explorer); see file-explorer
  10. the slash menu; see slash-menu
  11. the keys tray; see shell-keys
  12. the Agent Commander's popup (#commander-pop), back to the tab under it; see agent-commander
  13. shell mode, back to the agent; see shell-mode
  14. the new-thread page, back to the tab it was reached from

With all of those closed, back leaves the app.

Escape closes the same list, one press at a time, from the screenshot down to the Commander's popup. With a turn running in the popup, Escape stops that turn first, and the next press closes it. It leaves the keyboard up, and the last two are modes rather than layers over the screen, so Escape leaves shell mode and the new-thread page alone. With all of them closed and a turn running, Escape stops the turn; see stop-a-running-turn. With nothing open and nothing running the key is the browser's again, so a full-screen window still leaves full screen.

Ctrl+W (⌘W on a Mac) closes the same layers as Escape, from anywhere, the file editor included. A file with unsaved edits is not closed at once: a card asks Save changes?, with Save, Discard and Cancel, as its × does. With nothing open over the screen, Ctrl+W closes the tab you are in; see close-and-reopen-tabs.

A field or a menu the key was typed into takes it first: a tab being renamed, the slash menu, the folder menu in the new-thread card, and the explorer's filter while it has something in it. Press Escape again for the layer under it.

Limits and known gaps