LyTop is a terminal-based, htop-like system monitor for Linux, designed to be lightweight, extensible, and scriptable. It provides a live overview of memory usage and active processes and supports user-defined widgets through Lua.
-
Memory Usage Bar
Displays RAM usage with multiple colored segments:- Green: Used memory
- Yellow: Cached memory
-
Process Table
Dynamically shows active processes sorted by memory use. -
Overlay Widgets
Toggleable help and debug boxes rendered directly in the UI. -
Keybindings
j/k: Scroll process lista: Toggle kernel processesh: Toggle help overlayd: Toggle debug overlayq: Quit
- A C++20-compatible compiler (GCC or Clang)
- Lua 5.4
- A POSIX-compatible terminal (Linux/macOS)
Clone the repository and build:
git clone -b --recurse-submodules stable https://github.com/HasSak-47/monitor.git
cd monitor
make build # Build the application
make run # Run the default demoLytop is designed for Lua-driven customization. The entire interface—including widgets, rendering, and user input—is controlled from a Lua script.
Widgets follow a simple inheritance model using metatables. Each widget can implement:
:new()– Constructor:render(buffer)– Draw the widget:update()– Optional, for dynamic state
local Bar = widget:extend({
new = function(self)
local t = self.super.new(self)
setmetatable(t, self)
t._type = "Bar"
t.percentage = 0.5
return t
end,
render = function(self, buffer)
local x, _ = buffer:get_size()
buffer:set(1, 1, '[')
buffer:set(x, 1, ']')
for i = 1, math.floor((x - 2) * self.percentage) do
buffer:set(i + 1, 1, '|', { type = "bit", R = 1, G = 0, B = 0 })
end
end
})Bar– Simple single-value progress barMultiBar– Composite memory bar with multiple values/colorsBox– Draws a border around another widgetDebugData,HelpData– Optional overlays showing internal state or usage hintsM_type– Default UI layout: renders memory usage and process table, handles input
Memory values are automatically humanized using base-1024 formatting (e.g., 512MB, 2.1GB).
To create a new layout or behavior:
- Edit
init.lua(or your custom script) - Add or modify widgets using the provided API
- Use
stateto access system data (fps,tick,offset,processes, etc.) - Use
state.on_eventto bind keys