Compact layout patch for opencode.
When terminal width is ≤ 80 columns, reduces all horizontal padding to 1 character so content sits flush against the edges with a single-character margin.
Platform: Linux arm64, installed via the official bash installer. Other platforms (macOS, x64, musl) need a different build target — see Build targets. Not tested with Homebrew or other package managers, which install to different paths.
Tested against: v1.17.13 (commit 96d53c6)
# Clone opencode (if you haven't already)
git clone https://github.com/anomalyco/opencode ~/src/opencode
cd ~/src/opencode
# Apply patch
curl -O https://raw.githubusercontent.com/brfid/opencode-wide/main/compact-layout.patch
git apply compact-layout.patch
# Install dependencies and build
cd packages/opencode
bun install
OPENCODE_VERSION=$(grep -m1 '"version"' package.json | cut -d'"' -f4) bun run build --single
# Install (use mv so it works even if opencode is running)
cp dist/opencode-linux-arm64/bin/opencode ~/.opencode/bin/opencode.new
mv ~/.opencode/bin/opencode.new ~/.opencode/bin/opencodeWhen opencode prompts you to upgrade:
cd ~/src/opencode
git pull
# Re-apply patch
git apply compact-layout.patchIf git apply fails because surrounding code changed:
git apply --reject compact-layout.patch
# Edit the .rej files manually to re-apply the same logical changes
# Then update the patch file:
git diff packages/ > compact-layout.patchThen rebuild and install with the new version:
cd packages/opencode
OPENCODE_VERSION=$(grep -m1 '"version"' package.json | cut -d'"' -f4) bun run build --single
cp dist/opencode-linux-arm64/bin/opencode ~/.opencode/bin/opencode.new
mv ~/.opencode/bin/opencode.new ~/.opencode/bin/opencodeSetting OPENCODE_VERSION is important — without it the binary reports a dev version and
opencode will nag you to upgrade on every launch. Don't use git describe --tags: this repo's
tag history is mixed with mirror tags (github-v*) that aren't real releases and can produce a
bogus version string. packages/opencode/package.json is the reliable source.
Change the binary name to match your platform:
| Platform | Binary name |
|---|---|
| Linux arm64 | opencode-linux-arm64 |
| Linux x64 | opencode-linux-x64 |
| macOS arm64 | opencode-darwin-arm64 |
| macOS x64 | opencode-darwin-x64 |
For macOS (Homebrew install), the binary path will differ — find it with which opencode.
Two files in packages/tui/src/:
routes/session/index.tsx— outer container padding, content width formula, and inner message padding (user messages, assistant text, tool blocks, reasoning blocks)component/prompt/index.tsx— textarea container padding
The threshold <= 80 appears as a compact() memo in both files. All paddings that
would normally be 2–3 characters collapse to 0–1 in compact mode.