Skip to content

Add sys_monitor.lua example demonstrating live terminal rendering#236

Open
Gitkbc wants to merge 1 commit into
lunarmodules:mainfrom
Gitkbc:example/sys-monitor
Open

Add sys_monitor.lua example demonstrating live terminal rendering#236
Gitkbc wants to merge 1 commit into
lunarmodules:mainfrom
Gitkbc:example/sys-monitor

Conversation

@Gitkbc
Copy link
Copy Markdown
Contributor

@Gitkbc Gitkbc commented Apr 15, 2026

Adds a minimal system monitor example (examples/sys_monitor.lua) demonstrating real-time terminal rendering with terminal.lua.

Key Features

  • Rendering loop via terminal.initwrap()
  • CPU and memory metrics (cat /proc/stat, free -m)
  • ASCII progress bars
  • Exit with q or Ctrl+C

Notes

  • Minimal, Linux-focused example & can be extended for other platforms as well
  • Follows .editorconfig

@Gitkbc
Copy link
Copy Markdown
Contributor Author

Gitkbc commented Apr 15, 2026

@Tieske Sir, Just wanted to share some thoughts on the motivation behind this!

While this example is mainly for demonstration purposes (showcasing a real-time rendering loop with progress bars using terminal.initwrap()), I was thinking about a possible future direction. Turning the system monitoring concept (CPU + memory usage) into a reusable utility or widget (for example, terminal.widgets.system_monitor or a simple status bar).

This could allow TUI developers to easily display live resource usage inside their interfaces. For instance, before starting a heavy operation like installing large packages or libraries, the application could show current RAM/CPU usage as a "gateway" step. This would help improve UX and reduce the risk of out-of-memory crashes or stalls during resource-intensive tasks.

In real-world scenarios, memory exhaustion is common when running multiple heavy processes or installing large dependencies. A built-in, lightweight monitoring component could help developers create more reliable TUIs.

I'd love to hear your thoughts as well as get suggestions on this. If you feel this is a valid feature, I would be more than happy to open an issue and submit a PR to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant