Skip to main content

Daemon that synchronizes the Scroll Lock key with the keyboard LED on Linux.

Project description

Scroll Lock LED Daemon

Daemon for Linux that synchronizes a key press with the keyboard LED.

Features

  • Auto-detects keyboard and Scroll Lock LED
  • Listens for key presses and toggles the LED
  • Runs as a systemd service (Type=notify) with watchdog support
  • Auto-reconnects if the keyboard is disconnected
  • One-shot mode: --set on/off and --toggle for scripts
  • Configurable key (--key) and LED (--led)
  • Configuration file support
  • Very low CPU usage (event driven, not polling)
  • --doctor for system diagnostics
  • Structured JSON logging for production observability
  • Secure, automated releases with supply chain security (Sigstore)

Requirements

  • Linux
  • Python 3.10+
  • python3-evdev

Installation

Pacote .deb (Debian/Ubuntu — recomendado)

Baixe o .deb da página de releases:

sudo apt install ./scrolllock-led-daemon_*.deb

Instala automaticamente como serviço systemd com start imediato.

PyPI (pip)

pip install scrolllock-led-daemon

Apenas o binário — você precisa configurar o systemd e udev manualmente.

Script manual (desenvolvimento)

git clone https://github.com/alan-n7x/scrolllock-led-daemon.git
cd scrolllock-led-daemon
./scripts/install.sh

Usage

Daemon mode (default)

sudo systemctl start scrolllock-led-daemon

One-shot mode

scrolllock-led-daemon --set on
scrolllock-led-daemon --set off
scrolllock-led-daemon --toggle

List devices

scrolllock-led-daemon --list

Diagnostics

scrolllock-led-daemon --doctor

Custom device

scrolllock-led-daemon --device /dev/input/event9 --led scrolllock

Custom key

scrolllock-led-daemon --key KEY_F12 --led capslock

Configuration

Settings can be persisted in /etc/scrolllock-led-daemon.conf or ~/.config/scrolllock-led-daemon/scrolllock-led-daemon.conf:

[daemon]
device = /dev/input/event4
led = scrolllock
key = KEY_SCROLLLOCK
verbose = false

CLI arguments override config file values.

Observability

The daemon emits structured JSON logs to stdout (captured by systemd/journald) for easy integration with logging systems like ELK, Datadog, or Splunk, or Splunk.

Example log entries:

{
  "timestamp": "2023-07-05T12:34:56.789Z",
  "level": "INFO",
  "name": "root",
  "message": "LED state changed",
  "event": "led_state_changed",
  "device_path": "/dev/input/event0",
  "device_name": "AT Translated Set 2 keyboard",
  "led_type": "scrolllock",
  "new_state": "on"
}

Systemd watchdog is enabled to automatically restart the daemon if it becomes unresponsive.

Development

Dependencies

pip install ".[test]"

Tests

make test          # or: python -m pytest tests/ -v

Contract tests

python -m pytest tests/test_evdev_contract.py -v

Syntax check

make lint          # or: python -m py_compile src/scrolllock_led_daemon.py

Security

Releases are signed using Sigstore's keyless signing via GitHub Actions OIDC, providing cryptographic provenance without managing GPG keys in CI.

Each release includes an in-toto SLSA provenance attestation and SBOM (Software Bill of Materials) for supply chain security verification.

Uninstallation

Via .deb

sudo apt remove scrolllock-led-daemon

Via script manual

./scripts/uninstall.sh

License

GNU General Public License v3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrolllock_led_daemon-1.5.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrolllock_led_daemon-1.5.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file scrolllock_led_daemon-1.5.0.tar.gz.

File metadata

  • Download URL: scrolllock_led_daemon-1.5.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scrolllock_led_daemon-1.5.0.tar.gz
Algorithm Hash digest
SHA256 5d3567307d3593658fb004c35c3a63aea7f35a9a1ffcf40a140fffdc11afbd9d
MD5 a8f45571c3e405fba305a052625106b3
BLAKE2b-256 feac720f32b9473b3a03db6ec91c4e044d7f93ca7beb4c4c25764778c7b192d9

See more details on using hashes here.

File details

Details for the file scrolllock_led_daemon-1.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scrolllock_led_daemon-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e184c431f56372a266e64e7ba422b3bd4df2d04952773c60e2b23e4d27dcd6e4
MD5 9f2abe8ad9bca121d96f5ccd958ebb1e
BLAKE2b-256 42d8a47610d02f455511a477c0ee2af587871049276d106196bd0e3980f72e5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page