Terminal system monitor in Gleam — htop × btop
monitor#
A terminal system monitor written in Gleam — sits between htop and btop.
| From htop | From btop |
|---|---|
| Dense process table (PID, USER, PRI, NI, VIRT, RES, S, CPU%, MEM%, TIME+, Command) | Color meters & sparklines for CPU / memory / swap |
Sort by column, filter (/), kill (k) |
Per-core CPU bars |
| Keyboard + mouse navigation | Clean alternate-screen TUI |
Requirements#
- Linux (
/proc) - Gleam + Erlang/OTP
- A modern terminal (truecolor optional, 256-color fine)
Run#
# if Erlang isn't on PATH (NixOS):
nix develop # or: nix-shell -p gleam beamPackages.erlang
gleam run
Keys#
| Key | Action |
|---|---|
↑ / u · ↓ / j |
Move selection (htop-style: k is kill, not up) |
PgUp / PgDn |
Page |
g / G |
Top / bottom |
c m p t n |
Sort by CPU / MEM / PID / TIME / name (press again to reverse) |
T |
Toggle tree: sort by value, then group each hot PID with its PPID family |
r |
Reverse sort (highest-first by default for CPU/MEM/TIME) |
/ |
Filter (substring on command, user, pid, ppid) |
k / K |
Kill selected process (SIGTERM, confirms) |
Space |
Force refresh |
h / ? |
Help |
q / Esc |
Quit |
Mouse#
| Action | Effect |
|---|---|
| Click process row | Select that process |
| Click table header (PID / CPU% / MEM% / TIME+ / Command) | Sort by that column (again to reverse) |
| Scroll wheel | Move selection |
| Right-click process | Select and confirm kill (SIGTERM) |
| Click (help / kill dialog) | Close help · cancel kill confirm |
Architecture#
src/
monitor.gleam entrypoint
app.gleam event loop, keys, refresh
ui.gleam layout & rendering (etch)
sys.gleam /proc collectors
format.gleam bars, sizes, sparklines
Built with etch for the TUI backend.