Midnight Commander (mc)
What it is
Section titled “What it is”Midnight Commander is a Norton-Commander-style dual-panel file manager that has been the standard terminal file tool on Unix for three decades. Two side-by-side panels each show a directory listing; you operate on files by selecting in one panel and acting toward the other (copy/move target is “the other panel”). A row of F-key labels runs along the bottom of the screen, a single command line sits just above it, and the active panel is visually distinguished. It bundles a text/hex viewer and an editor (mcedit), and its VFS lets you step into a .tar/.zip/.rpm archive or an FTP/SFTP remote as if it were a local directory.
For KN-86 this is the reference implementation of two patterns the device already commits to: a bottom function-key bar (KN-86’s firmware Row 24 action bar is the same idea) and a two-pane working layout with explicit active-pane focus. mc has been ported to every terminal that has ever existed precisely because its UI assumes almost nothing about the terminal — which is exactly the portability posture KN-86’s amber grid needs. (Reference “CLAUDE.md Canonical Hardware Specification” for the grid; not restated here.)
UI / layout / interaction
Section titled “UI / layout / interaction”The screen is a fixed vertical stack — top to bottom:
| Region | Role |
|---|---|
| (optional) Menu bar | Top line; pull-down menus (Left / File / Command / Options / Right) |
| Two panels | Left + right directory listings, side by side, filling the bulk of the screen |
| Hint / command line | Single editable shell command line above the key bar |
| F-key function bar | Bottom line: 1Help 2Menu 3View 4Edit 5Copy 6RenMov 7Mkdir 8Delete 9PullDn 10Quit |
- Panels are columnar directory listings with selectable metadata columns (name, size, mtime, permissions, etc.); the listing format is configurable. Each panel scrolls independently and remembers its own directory and cursor.
- Active-panel focus is shown by highlighting the active panel’s frame/selection bar; only one panel is active at a time, and most operations are oriented “from active → inactive.” The README confirms
Tabswitches the active panel. - File-operation dialogs — copy/move/delete pop a centered modal dialog (source pattern, destination, options, a progress bar). These dialogs are a small windowing system inside the terminal: framed boxes, labeled buttons, focusable fields.
- The F-key bar is the always-visible verb advertisement — at any moment the bottom line tells you the 10 primary actions available, and pressing the F-key (or
ESC+digit on terminals without F-keys) invokes it. This is exactly the role KN-86’s Row 24 action bar plays: a persistent, context-labeled action strip the operator can always read.
Rendering — monochrome-adaptable
Section titled “Rendering — monochrome-adaptable”mc draws with ncurses or S-Lang — character cells, box-drawing borders, attribute-based highlighting. It uses color where available, but its entire layout is legible in monochrome: panel borders are box-drawing characters, the active panel is shown by reverse-video (inversion) on the selection bar, and the F-key bar distinguishes the digit from the label by attribute. Nothing in the core layout requires color — focus and selection ride on inversion, structure rides on box-drawing glyphs. That is the precise toolkit KN-86 has on the amber grid, which is why mc’s layout ports almost unchanged.
Navigation / keybindings
Section titled “Navigation / keybindings”Tab— switch active panel (the single most important key).- F-keys —
F1Help,F3View,F4Edit,F5Copy,F6Rename/Move,F7Mkdir,F8Delete,F9top menu,F10Quit.ESC+digit substitutes on F-key-less terminals. - Arrows /
C-n/C-p— move the selection within a panel (Emacs-style bindings throughout). M-p/M-n— command-line history;M-Tab— filename completion.Enter— descend into a directory or “execute” the selection (including stepping into an archive via VFS).- Emacs-flavored editing on the command line and in
mcedit.
Architecture
Section titled “Architecture”- VFS (Virtual File System) — the standout architectural idea. A path can transparently resolve into an archive (
tar,zip,rpm, …) or a network location (FTP, SFTP, SHELL-over-SSH), and the panel browses it as if local. The file-manager UI is decoupled from where the bytes actually live behind a uniform VFS interface. - Subshell integration — mc hosts a live shell (bash/zsh/tcsh) behind the panels; the command line drives it and the cwd stays in sync with the active panel.
- Built-in viewer / hex viewer / editor —
mcview(text + hex),mcedit(syntax-highlighting editor) are integrated, so the file manager is also a lightweight read/edit environment without spawning external tools. - The UI toolkit (panels, dialogs, buttons, input lines, the menu bar) is a small terminal widget library internal to mc — a from-scratch TUI windowing kit predating modern frameworks.
Single-color adaptation
Section titled “Single-color adaptation”mc is already a near-monochrome design; the read-across to KN-86’s amber grid:
- Active-panel focus via inversion, not color. mc highlights the active panel’s selection bar with reverse video. KN-86 maps directly: the focused pane / selected row renders inverted (black-on-amber). One bit, unambiguous.
- Structure via box-drawing glyphs. Panel frames, dialog borders, and column separators are CP437/Unicode box characters — present in KN-86’s character set, color-free, and the primary way to communicate layout regions on a single-color grid.
- The F-key bar’s digit/label pairing survives monochrome by typography, not color: the digit is the affordance, the word is the label. KN-86’s Row 24 should follow the same
N labelpairing the operator can read at a glance. - Metadata columns instead of color-coded file types. Where a colorized
lsuses hue to mark directories/executables/symlinks, mc-on-a-mono-terminal falls back to trailing-character markers (/dir,*exec,@symlink) and the permissions column — i.e. glyph and text carry the type, not color. Same lesson as Brogue: in monochrome, the character is the type. A KN-86 file/inventory/list cart should mark item categories with a leading or trailing glyph badge, never with an (unavailable) color.
Deckline feature inspiration
Section titled “Deckline feature inspiration”- Row 24 action bar = mc’s F-key bar. The single cleanest precedent for a persistent bottom action strip with digit-labeled verbs. Cross-link the Row-24 design in
docs/software/runtime/and the screen-design layout contract — mc validates that a fixed bottom verb bar is a beloved, decades-proven terminal-UI pattern. - Dual-panel layout for any KN-86 cart that does source→target operations (file/cart management, inventory transfer, trade screens, a “two-deck” compare view).
Tab-to-switch-focus + operate-toward-the-other-pane is a complete, learnable interaction model that fits Rows 1–23. - Modal file-operation dialogs — the framed, button-labeled confirmation modal is the right pattern for KN-86 destructive actions (delete save, overwrite, format cart); reusable UI pattern for the authoring docs.
- VFS-style uniform addressing — conceptually relevant to KN-86’s cartridge-as-block-device model (ADR-0019: the cart mounts as a standard filesystem); a “browse into the cart” affordance is natural.
- Batch 8. The brief specifically flagged the F-key bar (Row 24 cross-link) and dual-panel patterns — both captured above.
- Cross-link
docs/software/cartridges/authoring/screen-design-rules.md(the Row 0 / 1–23 / 24 contract; Row 24 is the action bar mc validates) anddocs/software/cartridges/authoring/ui-patterns.md(dual-panel + modal-dialog reusable patterns). - Cross-link opentui.md and the other TUI-framework references in this batch (desktop-tui.md, tvterm.md) — mc is the application exemplar of a hand-rolled terminal widget kit; those are the framework exemplars.
- The inversion-for-focus + box-glyphs-for-structure + glyph-badge-for-type triad is the same monochrome toolkit Brogue arrives at from the games side; this is the cluster’s convergent finding.