Files

1.6 KiB

Process Manager — monitor (Python)

A btop-style process manager in one 1024x768 window, built only from LightGUI XFrame widgets: XProcessList (live /proc table, sortable columns, click a row to select it), GtkEntry (filter by name or pid), and three GtkButtons — Terminate, Kill, Refresh.

What it shows

  • Processes — pid, program, user, memory and CPU% for the live processes on this machine, refreshed every 2 seconds. Click a column header to sort by it (click again to reverse); click a body row to select it (highlighted). CPU% is per-core with an in-cell bar.
  • Filter — click the entry, type a name or pid substring; the list shows only matching rows.
  • Terminate — sends SIGTERM to the selected process.
  • Kill — sends SIGKILL to the selected process.
  • Refresh — re-scans /proc immediately.

Safety: Terminate/Kill act on the selected row's pid only, and refuse pid ≤ 1 and the manager's own pid.

Build and run

PYTHONPATH=/root/pm-work/lightgui_python python3 examples/monitor_process_manager/main.py
# Esc or close the window to quit

Source

  • App: examples/monitor_process_manager/main.py in lightgui_python
  • Widgets: XProcessList (MonitorWidget), GtkButton, GtkEntry — this app adds row-selection and a name/pid filter to MonitorWidget (additive only; the widget demo is unchanged)

The same app exists in C and Rust — see the walkthrough.