diff --git a/CHANGELOG.md b/CHANGELOG.md index ec668c0..68b53ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.1.0 — 2026-10-07 + +- `N`, `C` and `M` sort directly by name, CPU or memory (command, CPU or + memory in the process view); `s` still cycles. + ## 1.0.0 — 2026-10-07 First release. diff --git a/README.md b/README.md index 186901b..8d3b8e8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ pids limit, I/O rates and uptime. ports, mounts, labels; environment hidden until you press `e`) and `l` follows the logs. Actions, each confirmed first: stop/start (`x`), restart (`r`), pause/unpause (`p`) and send a signal (`k`), to the container or, in the -process view, to the selected process. Search (`/`), sort (`s`), show stopped +process view, to the selected process. Search (`/`), sort (`s` to cycle, `N`/`C`/`M` for name, CPU, memory), show stopped (`a`), command line (`c`), help (`h`). Settings persist in `~/.config/dockertop/config`. See `man dockertop`. diff --git a/docs/dockertop.1 b/docs/dockertop.1 index ed5de57..8af7f46 100644 --- a/docs/dockertop.1 +++ b/docs/dockertop.1 @@ -189,6 +189,9 @@ Incremental search: over name, ID, image, compose project and status in the list; over command line, name, user and PID in the process view. \fBEnter\fR keeps the filter, \fBEsc\fR clears it. .TP +.B N, C, M +Sort by name (command in the process view), CPU or memory. +.TP .B s Cycle the sort column. The process view sorts by .BR CPU , diff --git a/main.go b/main.go index ef9ae1c..8b561e7 100644 --- a/main.go +++ b/main.go @@ -799,6 +799,18 @@ func (a *app) rune(r rune) (quit bool) { a.sortBy = (a.sortBy + 1) % len(sortNames) a.rebuild() } + case 'N', 'C', 'M': + name := map[rune]string{'N': "NAME", 'C': "CPU", 'M': "MEM"}[r] + if a.view == viewProcs { + if name == "NAME" { + name = "COMMAND" + } + a.psortBy = indexOf(psortNames, name) + a.rebuildProcs() + } else { + a.sortBy = indexOf(sortNames, name) + a.rebuild() + } case 't': if a.view == viewProcs { a.ptree = !a.ptree @@ -1388,7 +1400,7 @@ func (a *app) drawHelp() { "", "Keys", " Up/Down PgUp/PgDn Home/End move Enter processes d details (e: environment) l logs (Left/Right scroll)", - " / search s sort t tree a show stopped containers c command line h help q quit / back", + " / search s cycle sort N/C/M sort by name/CPU/memory t tree a show stopped containers c command line h help q quit / back", "", "Settings (sorts, trees, a, c, refresh) are saved to " + configPath() + " on exit.", "Needs access to the Docker socket (docker group or root). Signalling processes and container user names need root.",