retch-sysinfo 0.1.55

System information gathering library for retch
Documentation

retch-sysinfo

Crates.io Documentation License: GPL-3.0-or-later

A fast, concurrent, cross-platform hardware and system information gathering library for retch.

Extracted from the retch-cli binary to allow reuse as a standalone, zero-unnecessary-subprocess system probing library on Linux, macOS, and Windows.


Features

  • High-Performance & Concurrent: Probes run in parallel using scoped threads for minimal latency.
  • Zero Subprocess Overhead: Native Win32 FFI / WinRT COM on Windows, direct binary D-Bus socket connections on Linux, and Objective-C runtime FFI on macOS to avoid slow shell/interpreter forks.
  • Comprehensive Hardware & OS Detection:
    • CPU: Model name, physical/logical core count, P/E hybrid topology, frequency ranges, and cache sizes (L1/L2/L3).
    • GPU & VRAM: AMD GPUs (via libdrm amdgpu.ids & PCI IDs), NVIDIA, Intel, Apple Silicon, and Direct3D/WMI.
    • Displays: Multi-monitor resolution, refresh rates, and model/vendor names parsed from raw EDID binaries.
    • Memory & Storage: RAM capacity/usage, swap, physical DIMM speeds/types (SMBIOS/dmidecode), physical disks, NVMe/SATA/HDD identification, Btrfs subvolumes, and ZFS pools.
    • Network & Wi-Fi: Active default-route interface, local IPs, DNS domain/search scopes, Wi-Fi SSID/BSSID/channel/band/rate.
    • Peripherals: Audio servers/devices, Bluetooth controller status & connected devices, Battery health/cycle counts, Power adapters, Webcams/cameras, Gamepads/controllers, Input devices (Keyboards, Mice, Touchpads), and TPM versions.
    • Media & Player: Active media player name, playback status, and track metadata (artist, title, album).
    • Desktop Environment: DE, Window Manager, Login Manager, UI Theme, Icons, Cursor, Terminal, Shell, and Weather.

Usage

Add retch-sysinfo to your Cargo.toml:

[dependencies]
retch-sysinfo = "0.1"

Basic Example

use retch_sysinfo::{CollectOptions, SystemInfo};

fn main() {
    // Customize what fields to collect (or use CollectOptions::default())
    let options = CollectOptions::default();

    // Probe system information concurrently
    let info = SystemInfo::collect(&options);

    if let Some(os) = &info.os {
        println!("OS: {}", os);
    }
    if let Some(cpu) = &info.cpu {
        println!("CPU: {}", cpu);
    }
    if let Some(mem) = &info.memory {
        println!("Memory: {}", mem);
    }
}

Modules

retch-sysinfo provides modular subsystem detectors:

Module Description
audio Audio server (PipeWire, PulseAudio, ALSA, CoreAudio, WASAPI) and output devices
battery Battery status, charge level, health, time remaining, and power supplies
bios BIOS/firmware vendor, version, and release date
bluetooth Bluetooth adapter power state, name, and connected devices
btrfs Btrfs filesystem pools, allocation, and snapshot counts
camera Connected webcams and video capture devices
disk Filesystem mount usage and physical drive models (SSD/NVMe/HDD)
display Display connector resolution, refresh rate, and EDID model parsing
fetch Core orchestrator (SystemInfo, CollectOptions)
gamepad Connected gamepads, joysticks, and controllers
gpu GPU model detection and VRAM reporting
input Input devices (keyboards, mice, touchpads, graphics tablets)
media Active media player and playback track metadata
memory RAM usage, swap, and physical memory DIMM details
motherboard Motherboard / system vendor and model name
network Network interfaces, IP addresses, DNS domain, and Wi-Fi link status
packages Installed package counts (dpkg, rpm, pacman, flatpak, brew, etc.)
shell Current user shell and version
terminal Terminal emulator detection, window size, and font configuration
theme Desktop theme, icons, cursor, and system fonts
weather Current weather conditions
wm Window manager and desktop environment detection
zfs ZFS storage pool health and capacity

License

This project is licensed under the GPL-3.0-or-later license. See the top-level repository for details.