mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-10-23 08:07:34 -06:00
[PR #230] [CLOSED] feat(tui): add a narrow layout for terminals with fewer than 79 columns #231
Labels
No labels
api
bug
bug
cli / tui
dependencies
documentation
documentation
documentation
duplicate
enhancement
exporter
invalid
pull-request
pynvml
question
question
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/nvitop#231
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/XuehaiPan/nvitop/pull/230
Author: @Windyskr
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:mobile-layout📝 Commits (1)
e7598e2feat(tui): add a narrow layout for terminals with fewer than 79 columns📊 Changes
13 files changed (+568 additions, -91 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
nvitop/tui/library/__init__.py(+4 -0)📝
nvitop/tui/library/libcurses.py(+10 -0)📝
nvitop/tui/library/messagebox.py(+52 -20)📝
nvitop/tui/library/utils.py(+7 -0)📝
nvitop/tui/screens/help.py(+140 -2)📝
nvitop/tui/screens/main/__init__.py(+3 -1)📝
nvitop/tui/screens/main/panels/device.py(+230 -34)📝
nvitop/tui/screens/main/panels/host.py(+25 -4)📝
nvitop/tui/screens/main/panels/process.py(+42 -13)📝
nvitop/tui/screens/metrics.py(+26 -10)📝
nvitop/tui/screens/treeview.py(+5 -2)📝
nvitop/tui/tui.py(+23 -5)📄 Description
Issue Type
Runtime Environment
3.12.14/3.12.13590.48.01/617.42nvitopversion or commit:main@4796321+ this PRnvidia-ml-pyversion:13.615.71en_US.UTF-8Description
Terminals from 50 to 78 columns now get a narrow layout instead of the "needs at least a width of 79" message. Layouts at 79 columns and above are unchanged.
%CPU,%MEM,TIME,COMMAND) scroll with the arrow keys as before. The header row is cut to the panel so it no longer overwrites the right border.HELP_TEMPLATE, with no duplicated text. The header is wrapped to the width, and every keybinding keeps its color and the--readonlydimming. When the help is taller than the terminal, the arrow keys,j/kandPageUp/PageDownscroll it, and any other key returns as before. The 79+ column help screen is unchanged.!SUPERUSERor!), and it is restored when the selection is cleared.user@hostcontext is cut so it doesn't overwrite the panel title.CursesShortcuts.addstrclips strings at the right edge of the window instead of letting curses wrap them onto the next line, so screens without a dedicated narrow layout degrade gracefully.nvitop -1keeps printing the standard 79+ column layout on narrow terminals.The minimum width (50) and the standard layout width (79) are the new
MIN_WIDTHandLAYOUT_WIDTHconstants innvitop/tui/library/utils.py.Motivation and Context
I often check my GPU server from my phone with a remote SSH app. In portrait mode the terminal is only 73 columns wide, so all nvitop shows is:
I couldn't see the GPUs at all unless I rotated the phone and shrank the font until it was unreadable. With this change the same 73-column terminal shows all 8 GPUs, the host and the processes on one screen.
Testing
pre-commit run --all-files: ruff, ruff-format, codespell, mypy and pylint pass on the changed files. The only pylint messages are the existingE1120ones innvitop/api/libnvml.py, which show up onmainas well with my localnvidia-ml-py. xdoctest passes.mainand from this branch side by side in tmux, with digits and bar glyphs masked. They are identical at 79x20, 79x40, 100x40 and 140x50 in auto, compact (c) and full (f) modes, the help screen (including pressingDownand other keys there) and the tree view, apart from live data in the history graphs and the version string.nvitop -1output is identical atCOLUMNS= 50, 60, 73, 79 and 120.a,c,f,h,t,e,r,PageDown, process selection, horizontal scrolling, tagging, sort order (.and/), the metrics screen (Enter), live resizes to 45, 60 and 140 columns, and scrolling the help screen.--ascii,--colorful,--light,-m compact,-m full,--only 0and--readonly.qexits with status 0. Widths 40 and 49 still show the "needs at least a width of 50" message.Tconfirmation and closed it withEsc. At 73 I sentSIGTERM; at 50 I moved toSIGKILLwith the arrow keys and confirmed. In both cases the highlight covered the selected button and the process received the signal.mainand this branch render identically at 79, 100 and 140 columns in auto, compact and full modes. At 50 and 73 columns the narrow rows show0:0/0:1, the instance name and the memory / utilization bars, including anN/Autilization.IS_SUPERUSERpatched toTrueon the 8-GPU server, at 50, 60, 73, 78, 79 and 100 columns: the caution is shown, then shortened next to the signal hint while a process is selected (only below 78 columns), then restored afterEsc. 79 and 100 columns matchmain.Images / Videos
73 columns, 8x A800 (the process list is omitted here because it shows other users' jobs):
50 columns, a GPU with a fan,
--ascii:The signal confirmation at 50 columns:
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.