Linux device manager for Logitech devices
Go to file
Ken Sanislo 9b627410b6 common: render RGB color values as 0xrrggbb in config and solaar show
24-bit RGB values stored in PerKeyLighting per-key maps and in
LEDEffectSetting `.color` fields currently dump as decimal integers in
both the YAML config file and `solaar show` output:

    per-key-lighting: {1: -1, 2: 16733440, 3: 16755200, ...}
    LEDs Keys: {1:-1, 2:16733440, 3:16755200, ...}

Hex is the canonical RGB representation. Render colors as `0xrrggbb`
everywhere: solaar show output, repr, and YAML config dumps. Both new
values and legacy values from pre-existing YAML configs migrate
transparently.

Implementation: a `ColorInt(int)` subclass in `common.py`.

  - `str(c)` / `repr(c)` → `'0xrrggbb'` for 0..0xFFFFFF; falls back to
    decimal for out-of-range values so sentinels like
    `COLORSPLUS["No change"] = -1` still display naturally.
  - Constructor accepts ints AND hex strings (`'0xrrggbb'` or
    `'#rrggbb'`) so pre-existing configs that wrote decimal continue
    to load.
  - YAML representer emits a hex int literal (`tag:yaml.org,2002:int`
    with style `'0xrrggbb'`). YAML 1.1 parses hex int literals back as
    plain ints with no custom loader registration — values round-trip
    cleanly without a custom YAML tag.

Wiring:

  - `Range` gains a `value_type=int` field; `MapRangeValidator.validate_read`
    wraps results through `rng.value_type(...)`. PerKeyLighting's
    `_COLOR_RANGE` sets `value_type=ColorInt`; other Range users keep
    the int default with no behavior change.
  - PerKeyLighting overrides `update()` and `update_key_value()` to wrap
    raw ints in `ColorInt` at write time. `type(v) is int` (exact
    match, not isinstance) deliberately excludes NamedInt sentinels and
    avoids re-wrapping existing ColorInts.
  - `LEDEffectSetting.__init__` wraps the `color` param in `ColorInt`
    with the same guard, so zone-effect color round-trips as hex
    through `yaml.dump(setting)` / `val_to_string`.
  - `MapRangeValidator.to_string` re-wraps raw ints loaded from YAML
    (which `yaml.safe_load` returns as plain Python ints regardless of
    the choice's `value_type`) through `rng.value_type` before
    formatting. Without this, `solaar show` would render legacy saved
    values as decimal even after the rest of the pipeline is hex-aware.

Coverage: 12 new unit tests across `test_common.py` and
`test_settings_validator.py`:

  - ColorInt str/repr, equality with plain int, hex-string constructor
    (0x / 0X / # prefixes), out-of-range fallback to decimal, YAML
    dump format, plain-int round-trip on load, dict-value formatting.
  - MapRangeValidator.to_string: plain-int re-wrap via value_type,
    pass-through for already-wrapped ColorInts, NamedInt sentinel
    preservation, and no behavior change for int-typed Ranges.

Existing test fixtures updated: _PERKEY_COLOR_RANGE now carries
value_type=ColorInt to match runtime _COLOR_RANGE.

702 tests pass; pre-commit clean.
2026-05-12 12:51:36 -04:00
.github doc: instructions on running solaar show in 1.1.18 2025-12-21 18:01:53 -05:00
bin Remove Python 2 specific path handling 2025-01-01 10:18:44 -05:00
docs docs: document haptic capability 2026-04-18 16:31:17 -04:00
lib common: render RGB color values as 0xrrggbb in config and solaar show 2026-05-12 12:51:36 -04:00
po po: updating a few German strings (#3212) 2026-05-12 09:49:29 -04:00
rules.d docs: document change to use uinput only 2026-03-08 20:58:43 -04:00
rules.d-uinput Apply uaccess rules on all actions other than remove 2025-09-08 10:11:52 -04:00
share release 1.1.19 2026-01-08 12:32:44 -05:00
tests common: render RGB color values as 0xrrggbb in config and solaar show 2026-05-12 12:51:36 -04:00
tools Add installation guide for Solaar on RHEL 10 (#3158) 2026-03-08 20:54:31 -04:00
.coveragerc Test coverage: Fix keysyms to be visible (#9) 2024-10-11 07:42:38 -04:00
.git-blame-ignore-revs git-blame-ignore-revs: add pre-commit bulk change 2020-07-07 16:10:37 +01:00
.gitignore Ignore macOS junk files and pipenv config 2025-01-02 17:18:39 -05:00
.pre-commit-config.yaml dist: modify pre-commit args to make ruff change files 2024-02-21 16:06:22 -05:00
.python-version dist: update pre-commit versions and python version 2022-11-23 14:20:56 -05:00
CHANGELOG.md release 1.1.19 2026-01-08 12:32:44 -05:00
COPYRIGHT clarify license status; fix debian packaging copyight notice 2019-12-24 18:53:43 +00:00
LICENSE.txt Simplify name of license file 2024-03-02 18:15:56 -05:00
MANIFEST.in Simplify name of license file 2024-03-02 18:15:56 -05:00
Makefile tools: add python3-devel to install-dnf in Makefile 2025-12-20 12:31:17 -05:00
README.md docs: make known issues more prominent 2025-10-23 08:16:05 -04:00
RELEASE.md Rename changelog.md to all capitals 2024-03-02 18:15:56 -05:00
RHEL.md Improve RHEL installation guide and add automated install example (#3162) 2026-03-10 07:43:25 -04:00
Release_Notes.md release: drop testing of Python before 3.13 2025-12-12 04:55:14 -05:00
mkdocs.yml docs: update files shown in documentation 2025-10-23 09:28:52 -04:00
pyproject.toml ruff: Force single line imports 2024-03-13 15:41:21 -04:00
release.sh misc: Use PATH instead of hardcoded absolute paths (#3014) 2025-11-04 03:28:10 +09:00
setup.py Add per-key RGB color painter and replace MAP_CHOICE color validator 2026-05-10 17:52:55 -04:00

README.md

Solaar

Solaar is a Linux manager for many Logitech keyboards, mice, and other devices that connect wirelessly to a Unifying, Bolt, Lightspeed or Nano receiver as well as many Logitech devices that connect via a USB cable or Bluetooth. Solaar is not a device driver and responds only to special messages from devices that are otherwise ignored by the Linux input system.

More Information - Usage - Capabilities - Rules - Manual Installation - Known Issues

codecov License: GPL v2

 

 

Solaar supports:

  • pairing/unpairing of devices with receivers
  • configuring device settings
  • custom button configuration
  • running rules in response to special messages from devices

For more information see the main Solaar documentation page. -

Installation Packages

Up-to-date prebuilt packages are available for some Linux distros (e.g., Fedora) in their standard repositories. If a recent version of Solaar is not available from the standard repositories for your distribution, you can try one of these packages:

Solaar is available from some other repositories but may be several versions behind the current version: