XProcessList

XProcessList

XProcessList is a Monitor widget in LightGUI's XFrame widget set. Live process table: sortable columns, in-cell CPU% bars, colour-coded rows, auto-refresh.

XProcessList is the live table: one row per process with sortable columns, a CPU% bar drawn inside its cell, and rows colour-coded by state. It refreshes itself, so the table stays current without your app re-reading anything — pick the sort column and the row cap and let it run.

XProcessList running under Xvfb
XProcessList running — screenshot taken from the example below under Xvfb.

Key methods

  • set_sort_column(c) — which column the rows sort by
  • set_max_rows(n) — how many rows to show (default 10)
  • sort_rows() — re-sort the rows now

Every widget also gets the shared properties visible, enabled, bounds (x, y, width, height) and style_name, plus the background / foreground colours from the active style.

Example

Sort column and row cap are the only setup — the list refreshes itself.

XProcessList widget(display, screen, window, gc, &styles, 20, 20, 720, 480);
widget.set_sort_column(1);  // sort by CPU%
widget.set_max_rows(10);
widget.draw();

The snippet above is the widget part only. As with every XFrame example, the full program opens a display, creates a window and a style manager, then runs the standard event loop — see the complete example in the repo.

Build it from the repo root:

g++ -std=c++17 -Iwidgets/components -Iwidgets examples/XProcessList.cpp -lX11 -o XProcessList

Run it under Xvfb or a real X server; close the window to quit.

Example in the repo

The full working example is examples/XProcessList.cpp in the lightgui repo (C is canonical). The same widget is ported to the Rust and Python repos under the same name — see the links below.

Get the code

These widgets ship in all three LightGUI repos:

See also

Linux Rocks Every Day
Source code: LightGUI (C) · LightGUI (Rust) · LightGUI (Python)