Module data

Data gathering facilities for conky widgets

Functions

EagerLoader:init(fetch_data) Create an EagerLoader instance.
eager_loader:load() Run a bulk conky_parse with collected strings from previous updates.
eager_loader:get([remember=1], var[, ...]) Retrieve a conky_parse result.
cpu_percentages(cores) Get the current usage percentages of individual CPU cores
cpu_frequencies(cores) Get the current frequencies at which individual CPU cores are running
cpu_temperatures() Get the current CPU core temperatures relies on lm_sensors to be installed
fan_rpm() Get the current speed of fans in the system relies on lm_sensors to be installed
memory(unit) Get current memory usage info
network_speed(interface) Get volume of down- and uploaded data since last conky update cycle.
gpu_percentage() Get current GPU usage in percent.
gpu_frequency() Get current GPU frequency.
gpu_temperature() Get current GPU temperature.
gpu_memory() Get current VRAM usage.
gpu_power_draw() Get current GPU power draw.
gpu_power_limit() Get current GPU power draw.
gpu_top() Get list of GPU processes with individual VRAM usage in MiB.
is_mounted(path) Is the given path a mount?
drive_percentage(path) Get the drive usage in percent for the given path.
diskio(device[, mode[, unit]]) Get activity of a drive.
find_devices() Detect mount points and their respective devices plus physical devices.
device_temperatures() Get current HDD/SSD temperatures.
hddtemp() DEPRECATED; Get current HDD/SSD temperatures.

Local Functions

convert_unit(from, to, value) Convert memory value from one unit to another.


Functions

EagerLoader:init(fetch_data)
Create an EagerLoader instance. Pass a function that takes a list of keys and returns an iterator of values.

Parameters:

  • fetch_data function
eager_loader:load()
Run a bulk conky_parse with collected strings from previous updates. Called at the begin of each update to greatly improve performance.
eager_loader:get([remember=1], var[, ...])
Retrieve a conky_parse result.

Parameters:

  • remember int (default 1)
  • var string string to be evaluated by conky_parse
  • ... Additional arguments passed to var:format(...) (optional)

Returns:

    string result of conky_parse(var)

Usage:

    data.eager_loader:get("$update")
    data.eager_loader:get("${cpu cpu%s}", 2)  -- usage of second CPU core
    data.eager_loader:get(5, "${fs_used_perc %s}", "/home")  -- cached for 5 updates
cpu_percentages(cores)
Get the current usage percentages of individual CPU cores

Parameters:

  • cores int number of CPU cores

Returns:

    {number,...}
cpu_frequencies(cores)
Get the current frequencies at which individual CPU cores are running

Parameters:

  • cores int number of CPU cores

Returns:

    {number,...}
cpu_temperatures()
Get the current CPU core temperatures relies on lm_sensors to be installed

Returns:

    {number,...}
fan_rpm()
Get the current speed of fans in the system relies on lm_sensors to be installed

Returns:

    {number,...}
memory(unit)
Get current memory usage info

Parameters:

  • unit optional string like "B", "MiB", "kB", ...

Returns:

    number,number,number,number usage, easyfree, free, total
network_speed(interface)
Get volume of down- and uploaded data since last conky update cycle.

Parameters:

  • interface string e.g. "eth0"

Returns:

    number,number downspeed and upspeed in KiB
gpu_percentage()
Get current GPU usage in percent. Relies on nvidia-smi to be installed.

Returns:

    number
gpu_frequency()
Get current GPU frequency.

Returns:

    number in MHz
gpu_temperature()
Get current GPU temperature. Relies on nvidia-smi to be installed.

Returns:

    number temperature in °C
gpu_memory()
Get current VRAM usage. Relies on nvidia-smi to be installed.

Returns:

    number,number used, total in MiB
gpu_power_draw()
Get current GPU power draw. Relies on nvidia-smi to be installed.

Returns:

    number power draw in W
gpu_power_limit()
Get current GPU power draw. Relies on nvidia-smi to be installed.

Returns:

    number power draw in W
gpu_top()
Get list of GPU processes with individual VRAM usage in MiB. Relies on nvidia-smi to be installed.

Returns:

    {{string,number},...} list of {name, mem} value pairs.
is_mounted(path)
Is the given path a mount? (see conky's is_mounted)

Parameters:

  • path string

Returns:

    bool
drive_percentage(path)
Get the drive usage in percent for the given path.

Parameters:

  • path string

Returns:

    number
diskio(device[, mode[, unit]])
Get activity of a drive. If unit is specified the value will be converted to that unit.

Parameters:

  • device string e.g. sda1
  • mode string "read" or "write"; both if nil (optional)
  • unit string like "B", "MiB", "kB", ...; no conversion if nil (optional)

Returns:

    number,string activity, unit
find_devices()
Detect mount points and their respective devices plus physical devices.

Returns:

    table mapping of mount points (paths) to value pairs of (logical) device and physical device e.g. {["/"] = {"sda1", "sda"}}
device_temperatures()
Get current HDD/SSD temperatures. Relies on hwmon information in /sys/block. Requires drivetemp kernel module.

Returns:

    table mapping devices to temperature values
hddtemp()
DEPRECATED; Get current HDD/SSD temperatures. Relies on hddtemp to be running daemon mode. The results depend on what hddtemp reports and may require manual configuration, e.g. via /etc/default/hddtemp For experimental NVME support, requires "nvme smart-log" to be available and added as an exception in sudoers, hddtemp does not support NVME.

Since hddtemp is unmaintained and nvme support has been added to the kernel this function is deprecated. -> use data.device_temperatures

Returns:

    table mapping devices to temperature values

Local Functions

convert_unit(from, to, value)
Convert memory value from one unit to another.

Parameters:

  • from string like "B", "MiB", "kB", ...
  • to string or nil like "B", "MiB", "kB", ... For nil, no conversion happens.
  • value number amount of memory in from unit
generated by LDoc 1.4.6 Last updated 2023-03-26 23:57:51