A KDE system tray application for controlling Philips Hue lights with real-time screen synchronization.
# 1. Clone and setup
git clone <your-repo-url>
cd khuey
# 2. Configure your Hue bridge (if not done already)
openhue setup
# 3. Install everything
./scripts/install.shThat's it! The tray icon will appear in your system tray and auto-start on login.
If you prefer manual steps:
# Build backend
cd backend
go build -o hue-sync ./cmd/hue-sync
# Build tray app
cd ../trayapp
cmake . && make
# Install systemd service (optional, for auto-start)
cp ../systemd/hue-backend.service ~/.config/systemd/user/
systemctl --user enable --now hue-backend
# Install autostart file (optional)
cp ../systemd/hue-tray.desktop ~/.config/autostart/
# Start manually (if not using systemd)
../backend/hue-sync &
./hue-tray &- Scene Control: Activate any of your Hue scenes with room names
- Screen Sync: Real-time screen color synchronization with Hue lights (Entertainment API)
- 🎮 Gaming Mode: Automatic screen sync when gaming (CachyOS-optimized)
- 🔑 Restore Token: Eliminates screen share permission dialog
- Settings Dialog: GUI for bridge setup, room selection, and screen sync configuration
- Power/Brightness Controls: Toggle and dim lights with room/zone support
- Multi-zone Mapping: Different screen areas control different lights
- Desktop Notifications: Success/error feedback for all operations
- Auto-start: Backend and tray app start automatically on login
- System Tray Integration: Native KDE StatusNotifierItem integration
See FEATURES.md for complete feature documentation.
- Click the Hue icon in your system tray
- Select and activate scenes from the list
- Adjust power and brightness for configured rooms
- Access Settings for advanced configuration
Screen-to-lights synchronization using Entertainment API for gaming/movies. Enable via Settings Dialog or config file.
The backend reads the same file as openhue-cli: $XDG_CONFIG_HOME/openhue/config.yaml when XDG_CONFIG_HOME is set, otherwise ~/.openhue/config.yaml. See Configuration File Location. The backend logs the file it loaded at startup, and the tray's settings dialog shows it on the Connection tab.
The commands below use $CONFIG_FILE:
CONFIG_FILE="${XDG_CONFIG_HOME:+$XDG_CONFIG_HOME/openhue}"
CONFIG_FILE="${CONFIG_FILE:-$HOME/.openhue}/config.yaml"Bridge: "192.168.1.X" # Your bridge IP
Key: "YOUR-API-KEY" # API key from setup
clientkey: "CLIENT-KEY" # For Entertainment API (optional)
sync:
enabled: false
fps: 30 # Sync frame rate (10-60)
subsampleWidth: 64 # Performance tuningEach light can be mapped to a specific screen region for the Ambilight effect. Configure zones using UV coordinates (0.0-1.0):
- U (x-axis): 0.0 = left edge, 1.0 = right edge
- V (y-axis): 0.0 = top edge, 1.0 = bottom edge
channels:
- id: 0
active: true
deviceName: "Left Light"
gammaFactor: 2.2
uvA: {x: 0.0, y: 0.0} # Top-left corner
uvB: {x: 0.33, y: 1.0} # Bottom-right corner
- id: 1
active: true
deviceName: "Center Light"
gammaFactor: 2.2
uvA: {x: 0.33, y: 0.0}
uvB: {x: 0.67, y: 1.0}
- id: 2
active: true
deviceName: "Right Light"
gammaFactor: 2.2
uvA: {x: 0.67, y: 0.0}
uvB: {x: 1.0, y: 1.0}channels:
- id: 0
uvA: {x: 0.0, y: 0.0}
uvB: {x: 0.5, y: 1.0} # Left half of screen
- id: 1
uvA: {x: 0.5, y: 0.0}
uvB: {x: 1.0, y: 1.0} # Right half of screenchannels:
- id: 0 # Left edge
uvA: {x: 0.0, y: 0.25}
uvB: {x: 0.1, y: 0.75}
- id: 1 # Top edge
uvA: {x: 0.25, y: 0.0}
uvB: {x: 0.75, y: 0.1}
- id: 2 # Right edge
uvA: {x: 0.9, y: 0.25}
uvB: {x: 1.0, y: 0.75}
- id: 3 # Bottom edge
uvA: {x: 0.25, y: 0.9}
uvB: {x: 0.75, y: 1.0}Note: If UV coordinates are not specified, lights will auto-split the screen evenly (backward compatible).
# Check if backend is running
systemctl --user status hue-backend
# Restart backend
systemctl --user restart hue-backend
# Check logs
journalctl --user -u hue-backend -fRun openhue setup to configure your bridge, or check the config file exists (see Configuration).
# Check if tray app is running
ps aux | grep hue-tray
# Restart it
systemctl --user restart hue-tray
# Or manually: /path/to/hue-tray &Power and brightness controls are disabled. They need grouped light configuration - coming in a future update!
We welcome contributions! Please see CONTRIBUTING.md for:
- Development environment setup
- Git hooks with Lefthook
- Coding standards and conventions
- Testing procedures
- Pull request workflow
# Install Lefthook for Git hooks
go install github.com/evilmartians/lefthook/v2@latest
lefthook install
# This sets up automatic code formatting, testing, and validationProblem: Tray app says "DBus service not available"
# Check if backend is running
systemctl --user status hue-backend
# View backend logs
journalctl --user -u hue-backend -f
# Restart backend
systemctl --user restart hue-backendProblem: Backend won't start
# Check for errors in logs
journalctl --user -u hue-backend --no-pager -n 50
# Common issues:
# - Config file missing: check the config file exists (see Configuration)
# - Bridge address wrong: Update 'Bridge:' in config.yaml
# - API key invalid: Run 'openhue setup' to generate new keyProblem: "Cannot connect to Hue Bridge" notification
-
Check network connectivity
ping YOUR_BRIDGE_IP
-
Verify bridge IP in config
# $CONFIG_FILE is set under Configuration above grep -i Bridge "$CONFIG_FILE"
-
Test bridge manually
curl -k https://YOUR_BRIDGE_IP/clip/v2/resource
-
Use retry button
- Click notification's "Retry" button
- Or open control panel and click "Refresh"
Problem: Bridge IP changed (DHCP)
Set a static IP for your bridge in your router settings, or update the config:
# Edit config file ($CONFIG_FILE is set under Configuration above)
nano "$CONFIG_FILE"
# Update Bridge IP
Bridge: "192.168.1.X" # Your new IP
# Restart backend
systemctl --user restart hue-backendProblem: "Screen sharing permission denied"
This is normal the first time! You must:
- Click "Start Screen Sync"
- Approve the GUI permission dialog that appears
- Select which monitor to share
- Click "Share"
The dialog is shown by your desktop environment (XDG Desktop Portal) and is required for security.
Problem: Screen Sync button does nothing
# Check if Entertainment API is configured
# ($CONFIG_FILE is set under Configuration above)
grep -i entertainmentConfigurationId "$CONFIG_FILE"
# Create the Entertainment Area in the Hue app, then list the areas and their IDs
cd backend
go run ./cmd/get-entertainment-info
# Without a clientkey, register one. Copy the Key and clientkey it prints
# together: the Key is that clientkey's DTLS identity
go run ./cmd/register-entertainmentProblem: "Sync engine not available"
You need to configure Entertainment API:
- Open Hue app on phone
- Create an Entertainment Area (Settings → Entertainment Areas)
- Add your lights to the area
- Run
cd backend && go run ./cmd/get-entertainment-infoto list the areas and their IDs - Set
entertainmentConfigurationIdin the config file - Without a clientkey, run
go run ./cmd/register-entertainmentand copy the Key and clientkey it prints together
Problem: Scenes don't appear in list
# Check if scenes exist in Hue app
# Then verify backend can fetch them:
dbus-send --session --print-reply --dest=org.kde.plasma.hue \
/org/kde/plasma/hue org.kde.plasma.hue.GetScenesProblem: Scene activation fails
- Ensure lights are powered on (not physically off)
- Check bridge connection (see above)
- Verify scene still exists in Hue app
Problem: "uvA.x must be 0.0-1.0" or similar validation error
Your config file has invalid UV coordinates. UV coordinates represent screen zones:
0.0= left/top edge1.0= right/bottom edgeuvA= top-left corner,uvB= bottom-right corner
Example fix:
channels:
- id: 0
uvA:
x: 0.0 # Left edge
y: 0.0 # Top edge
uvB:
x: 0.5 # Middle (left half of screen)
y: 1.0 # Bottom edgeProblem: "sync.fps must be between 10 and 60"
Update your config:
sync:
fps: 30 # Recommended: 20-30
subsampleWidth: 64 # Recommended: 64Still stuck? Check:
- Logs:
journalctl --user -u hue-backend -f - DBus introspection:
dbus-send --session --dest=org.kde.plasma.hue --print-reply /org/kde/plasma/hue org.freedesktop.DBus.Introspectable.Introspect - GitHub Issues: Report bugs or ask questions
Progress: 10/15 components complete (67%)
✅ Project structure ✅ Configuration system ✅ Hue API client ✅ DBus service ✅ Qt tray application (KStatusNotifierItem) ✅ Scene control with room names ✅ Alphabetical sorting ✅ Desktop notifications ✅ Auto-start integration (systemd + KDE) ✅ Installation scripts ⏳ Power/brightness controls (needs room configuration) ⏳ Screen capture (Wayland/Pipewire) ⏳ Entertainment API streaming ⏳ Settings dialog
┌─────────────┐ DBus ┌──────────────┐
│ Qt Tray │◄─────────────────────►│ Go Backend │
│ App (KDE) │ │ │
└─────────────┘ │ - Config │
│ - Hue API │
│ - DBus IPC │
└──────┬───────┘
│
│ HTTPS
▼
┌──────────────┐
│ Hue Bridge │
└──────────────┘
- Frontend: Qt/C++ with KStatusNotifierItem
- Backend: Go with official openhue-go library
- IPC: DBus session bus
- Config: YAML (compatible with openhue-cli)
- Auto-start: systemd user service + KDE autostart
- Huenicorn - Entertainment API patterns
- openhue-cli - Hue API integration
GNU General Public License v3.0 - See LICENSE