luxafor-cli

command module
v0.0.0-...-8e5ac45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

luxafor-cli

A command-line tool for controlling the Luxafor Flag USB notification light, built on the luxafor-go library.

It includes luxafor watch, which mirrors desktop notifications from the D-Bus session bus onto the Flag (Linux).

Install

go install github.com/MarcMeszaros/luxafor-cli@latest

Or grab a .deb/.rpm from the releases (see Packaging).

On Linux the device needs a udev rule for non-root access — see Permissions. On macOS and Windows the build uses hidapi via cgo, so it requires a C toolchain (CGO_ENABLED=1).

Usage

Built with cobra; run luxafor --help (or luxafor <command> --help) for the full list. Required values are positional; optional ones are flags.

luxafor red                        # named-color shortcut
luxafor color 0 128 255            # RGB triple
luxafor color red --led flag       # target one bank of LEDs
luxafor black                      # black = off
luxafor fade green --speed 40
luxafor strobe red --speed 20 --repeat 5
luxafor wave 2 blue -s 30 -r 3
luxafor pattern 5 --repeat 2
luxafor firmware
luxafor watch                      # mirror D-Bus activity (Linux)

D-Bus watcher (Linux)

luxafor watch mirrors D-Bus session-bus activity onto the Flag. It uses the modern BecomeMonitor API (not the deprecated eavesdrop=true match) and runs until interrupted.

A YAML config is required (-c, or ~/.config/luxafor/config.yaml, or the system default /etc/xdg/luxafor/config.yaml). Everything lives under a top-level watch key, with one section per source:

watch:
  notifications:
    Slack:
      - name: "*"        # any Slack notification
        color: magenta
    "*":
      - name: BUSY
        color: red

See docs/watch.md for the full schema, supporting other apps, and running it as a systemd service.

Permissions (Linux)

By default /dev/hidraw* nodes are root-only. The .deb/.rpm packages install the udev rule automatically. To install it manually:

sudo cp packaging/99-luxafor.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
# ensure your user is in the plugdev group, then re-plug the device

Building & testing

The repo uses Task as a runner. With task installed:

task             # test + build the CLI (default)
task test        # run the test suite
task build       # build the CLI into ./bin/luxafor
task clean       # remove build artifacts

Plain go works too:

go test ./...
go run . red
Cross-compiling

Linux builds are pure Go; macOS/Windows use hidapi via cgo and need a C toolchain for the target.

task build:linux     # GOOS=linux  CGO_ENABLED=0 (pure Go)
task build:windows   # GOOS=windows CGO_ENABLED=1, needs a mingw cross-compiler
task build:darwin    # GOOS=darwin  CGO_ENABLED=1, run on a Mac (Xcode CLT) or with osxcross
Packaging (Linux)

.deb and .rpm packages are built with nfpm (go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest). They bundle the CLI, the udev rule, a systemd user unit for luxafor watch, and a default config.

VERSION=0.1.0 task package   # writes dist/*.deb and dist/*.rpm

Installing the package places the udev rule in /usr/lib/udev/rules.d/ and reloads udev, installs the watch service to /usr/lib/systemd/user/, and writes a default config to /etc/xdg/luxafor/config.yaml (so watch works before you create ~/.config/luxafor/config.yaml). Enable the service per user — run systemctl --user daemon-reload once so your session picks up the freshly installed unit, then systemctl --user enable --now luxafor-watch.service (see docs/watch.md).

License

MIT — see LICENSE.

Documentation

Overview

Command luxafor is a small CLI for driving a Luxafor Flag.

luxafor red                    # set all LEDs red
luxafor color 0 128 255        # set all LEDs to an RGB triple
luxafor color red --led flag   # set just the flag-side LEDs
luxafor black                  # turn off (black = off)
luxafor fade green --speed 40  # fade to green
luxafor strobe red -s 20 -r 5  # flash red 5 times
luxafor wave 2 blue -s 30 -r 3 # wave pattern 2, blue, 3 times
luxafor pattern 5 --repeat 2   # demo pattern 5 (police), twice
luxafor firmware               # print firmware version and serial
luxafor watch                  # mirror D-Bus activity onto the Flag (Linux)

Directories

Path Synopsis
internal
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL