Skip to content

shdwmtr/libnlctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libnlctl

A FOSS replacement for nano leafs proprietary "PC Screen Mirror Lightstrip" software.

Platform Support: Windows Linux.

Architecture

  • nlctld — system daemon that holds the HID device open and runs the current animation
  • nlctl — CLI tool that sends commands to the daemon over a Unix socket

State is persisted to /var/lib/nlctl/state.json, so the last-set mode is automatically restored after a reboot.

Installation

# Build nlctl
$ cargo build --release

# Create the system user
$ sudo useradd -r -s /sbin/nologin -M nlctl

# Set up the udev rule
$ echo 'SUBSYSTEM=="hidraw", ATTRS{idVendor}=="37fa", ATTRS{idProduct}=="8202", GROUP="nlctl", MODE="0660"' \
    | sudo tee /etc/udev/rules.d/99-nanoleaf.rules
$ sudo udevadm control --reload && sudo udevadm trigger

# Install binaries
$ sudo cp target/release/nlctld target/release/nlctl /usr/local/bin/

# Install and enable the systemd service
$ sudo cp nlctld.service /etc/systemd/system/
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now nlctld

The daemon starts immediately and will start automatically on every boot.

Usage

$ nlctl rainbow
$ nlctl solid --color 255,0,128
$ nlctl breathing --color 0,100,255
$ nlctl wave --color 255,50,0
$ nlctl reactive              # syncs LEDs to screen content
$ nlctl off
$ nlctl status

Reactive mode

Reactive mode captures the screen via X11 and sets each LED zone to the average color of the corresponding screen edge. nlctl forwards your $DISPLAY and $XAUTHORITY automatically through nlctl reactive. No extra configuration is needed as long as you run the command from within your desktop session.

No wayland support. Very doable, I just don't use it.

Zone layout

The strip wraps around the monitor. Zone counts default to 10,10,10,10 (bottom, left, top, right) and can be tuned:

nlctl reactive --zones 12,8,12,8

License

This project is available under the MIT license. See the LICENSE file for details.

About

A simple, standalone, cross platform controller for Nanoleaf PC Screen Mirror LS

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages