1 Getting Started
Vincent S. edited this page 2026-06-28 01:08:01 +02:00

Getting Started

Build

cargo build                          # default features: `nvidia` (libnvidia-ml.so) + `media` (D-Bus/MPRIS)
cargo build --no-default-features    # minimal: no NVML/GPU, no D-Bus media module
cargo build --no-default-features --features media   # non-NVIDIA machine, keep media

Feature flags gate one optional module and its heavy/platform-specific dependency, so a build can drop it entirely:

Feature Gates Runtime requirement
nvidia gpu module / nvml-wrapper libnvidia-ml.so
media media module / zbus a D-Bus session (MPRIS)

Modules without an optional dependency (system, network, storage, llama, audio, hyprland, ytmd) are always compiled and toggled at runtime via [modules.*] enabled = false instead.

Run

ALFRED_LOG=debug cargo run -- serve  # run the daemon (logging only initialised for `serve`)
cargo run -- get system              # one-shot client query against a running daemon

Config lives at ~/.config/alfred/config.toml; its absence is non-fatal (defaults are used). The socket defaults to $XDG_RUNTIME_DIR/alfred.sock. See Configuration for env vars.

Systemd (user service)

The daemon is meant to run under systemd --user:

~/.config/systemd/user/alfred.service
systemctl --user enable --now alfred
systemctl --user status alfred

Waybar integration

Waybar 0.15.0 has been more reliable with normal polling than with long-lived interval: 0 stream consumers, so the recommended setup polls alfred get:

"custom/system": {
    "interval": 2,
    "exec": "alfred get system",
    "return-type": "json",
    "format": "{}"
}

alfred stream <module> remains available for other long-lived consumers.

Shell completions

alfred completions zsh > ~/.local/share/zsh/site-functions/_alfred

Ensure that directory is in fpath before compinit in ~/.zshrc:

fpath=(~/.local/share/zsh/site-functions $fpath)
autoload -U compinit
compinit