Sync Philips Hue lights with screen colors on Linux. Uses PipeWire/XDG portal for Wayland-native capture.
# Arch
pacman -S python-dbus python-gobject python-numpy gstreamer gst-plugins-base
# Debian/Ubuntu
apt install python3-dbus python3-gi python3-numpy gstreamer1.0-tools gstreamer1.0-plugins-base
# pip (if needed)
pip install dbus-python PyGObject numpyOptional (for bridge discovery):
pip install zeroconf requestspython hue_setup.py- Discovers bridges on network (cloud API + mDNS)
- Press bridge button when prompted
- Select which light to sync
Config saved to config.json.
python hue_screen_sync.pySelect screen/monitor when portal dialog appears. Ctrl+C to stop.
Edit config.json:
{
"bridge_ip": "192.168.1.x",
"api_key": "your-api-key",
"light_id": "1",
"update_interval_ms": 100,
"smoothing_factor": 0.3,
"screen_portion": 0.33,
"saturation_boost": 1.4,
"warmth": 0.03
}| Key | Default | Notes |
|---|---|---|
update_interval_ms |
100 | Capture rate (ms) |
smoothing_factor |
0.3 | EMA coefficient, lower = smoother transitions |
screen_portion |
0.33 | Bottom % of screen to sample |
saturation_boost |
1.4 | Color saturation multiplier |
warmth |
0.03 | Shift toward warm (red-ish) tones |
Screen -> PipeWire -> GStreamer (64x36 RGB) -> bottom region avg
-> sRGB to CIE xy -> saturation/warmth adjust -> EMA smoothing
-> Hue bridge (HTTP PUT, coalesced @ 60Hz max)
- XDG portal for screen access (works on Wayland)
- Threaded HTTP sender to avoid blocking capture loop
- D65 white point fallback for dark/black screens
GPLv2 - see LICENSE