Skip to content

Commit 8813a4a

Browse files
committed
Improve TUI status and visibility
1 parent 803a2c6 commit 8813a4a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tui.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ import (
3030
"github.com/rivo/tview"
3131
)
3232

33+
const (
34+
naviText = `[white]↑/k[-] up • [white]↓/j[-] down • [white]q/x[-] exit • [white]r[-] redraw & jump on top • [white]0[-] sort by bitrate • [white]1[-] sort by packets • [white]2[-] sort by bytes • [white]3[-] sort by source IP • [white]4[-] sort by dest IP`
35+
)
36+
3337
// drawTUI displays a TUI (text-based user interface) with a table displaying
3438
// packet statistics. The TUI is updated in real time with the latest packet
3539
// statistics. The table has the following columns:
@@ -59,7 +63,7 @@ func drawTUI(objs counterObjects, startTime time.Time) {
5963
Select(0, 0).
6064
SetFixed(1, 1)
6165

62-
statsTable.SetTitle("Packet statistics").
66+
statsTable.SetTitle("Network traffic monitor").
6367
SetTitleAlign(tview.AlignLeft).
6468
SetBorder(true)
6569

@@ -106,8 +110,10 @@ func drawTUI(objs counterObjects, startTime time.Time) {
106110

107111
// navigation
108112
naviView := tview.NewTextView().
109-
SetTextColor(tcell.ColorYellow)
110-
naviView.SetText("Use cursor keys to move through the table. Press 'q' or 'x' to exit, 'r' for a jump to the beginning and a redraw.\nPress '0' for bitrate desc sort, '1' for packet desc sort, '2' for bytes desc sort, '3' for source IP asc sort, '4' for destination IP asc sort.")
113+
SetTextColor(tcell.ColorDimGray).
114+
SetWordWrap(true).
115+
SetDynamicColors(true)
116+
naviView.SetText(naviText)
111117

112118
// grid layout
113119
grid := tview.NewGrid().SetRows(2, 0, 3).

0 commit comments

Comments
 (0)