Configurable food scores from Open Food Facts — barcode, search, or camera scan, with editable JSON scoring profiles.
Scoring details: docs/scoring-engine.md.
make
sudo make installInstalls to /usr/bin/librefood, /usr/share/applications/org.librefood.Librefood.desktop, and hicolor icons under /usr/share/icons/hicolor/…. Override with PREFIX= / DESTDIR=. Uninstall: sudo make uninstall.
Optional: librefood --barcode 3017620422003 or --page profiles|history|favorites.
sudo pacman -S rust gtk4 libadwaita pkgconf gstreamer gst-plugins-base
# camera (optional): v4l-utils; usermod -aG video $USER # then re-login
# phone/libcamera path: libcamera gst-plugin-libcamera pipewiresudo apk add build-base cargo glib-dev pango-dev gdk-pixbuf-dev gtk4.0-dev clang23-dev libadwaita-dev
# camera (phones / CAMSS): see Camera section below
# USB webcam only: sudo apk add v4l-utils; sudo adduser $USER video # then re-loginSame list: alpine-dependencies.txt.
Two capture paths:
- USB webcams — raw V4L2 (MJPEG / YUYV single-plane). Needs
/dev/video*+videogroup. - Phone cameras (Qualcomm CAMSS, e.g. OnePlus fajita) — GStreamer
libcamerasrc(preferred) orpipewiresrc. Raw V4L2 STREAMON usually fails withBroken pipe; librefood detects CAMSS and skips retrying all nodes.
PipeWire is enough for Scan + Switch camera (Front↔Back). gst-plugin-libcamera is optional.
sudo apk add gst-plugins-base gstreamer-tools \
pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-gtk
# optional (preferred when packaged): libcamera + libcamerasrc
sudo apk add libcamera libcamera-tools || true
sudo apk add gst-plugin-libcamera || sudo apk add gst-plugins-libcamera || true
sudo adduser $USER video # then log out / inBuild deps for GStreamer Rust crates (already covered by glib-dev + typically):
sudo apk add gstreamer-dev gst-plugins-base-devVerify (pipewire-only OK):
gst-inspect-1.0 pipewiresrc # required on Alpine without libcamerasrc
gst-inspect-1.0 libcamerasrc # optional
gst-device-monitor-1.0 Video/Source | head -80 # Front/Back + object.serial
LIBREFOOD_CAMERA_DEBUG=1 ./target/release/librefood
# Scan → expect Back; Switch camera → preview must change (no freeze)sudo pacman -S v4l-utils gstreamer gst-plugins-base
# phone-class / libcamera path:
sudo pacman -S libcamera gst-plugin-libcamera pipewire| Variable | Purpose |
|---|---|
LIBREFOOD_CAMERA_DEBUG=1 |
Log probe / backend / STREAMON / chosen facing |
LIBREFOOD_CAMERA_DEVICE=/dev/video0 |
Force a V4L2 node (USB) |
LIBREFOOD_CAMERA_BACKEND=auto |
Default: libcamera first on CAMSS, else V4L2 then gst |
…=libcamera / pipewire / v4l2 |
Force one backend |
LIBREFOOD_CAMERA_FACING=back |
Prefer rear cameras (default). front / any also OK |
LIBREFOOD_CAMERA_NAME=… |
Exact camera id (PipeWire object.serial, libcamera id, or display name) |
LIBREFOOD_CAMERA_INDEX=0 |
Among matching facing cams, pick Nth (0 = primary rear) |
LIBREFOOD_CAMERA_ROTATE=auto |
Upright preview/decode: auto (default), or 0 / 90 / 180 / 270 (CW). Persist with make set-rotate ANGLE=90 → ~/.config/librefood/camera-rotate |
LIBREFOOD_CAMERA_MIRROR=auto |
Mirror after rotate: auto (front only), 1, or 0 |
On fajita (multiple cams), default is back (largest back area). Preview RGB is uprighted for portrait phones (sensor/api.libcamera.rotation when present, else 90° CW on CAMSS landscape frames) before GTK Picture and barcode decode. Switch camera cycles Back → Wide → Front → … (CAMSS V4L junk filtered). Last choice: ~/.config/librefood/camera-id.
LIBREFOOD_CAMERA_DEBUG=1 ./target/release/librefood
# if preview is still sideways: LIBREFOOD_CAMERA_ROTATE=270
# or: LIBREFOOD_CAMERA_NAME='<object.serial from gst-device-monitor>'Typed barcodes always work. Window placement follows Fractal/Snapshot patterns: phones (Phosh / ≤1080p short edge, e.g. fajita) maximize into the shell workarea; desktops open a floating ~800×640 window (resizable). Escape force-maximize: LIBREFOOD_NO_FULLSCREEN=1.