Add Ubuntu user service support

This commit is contained in:
ltadeu6 2026-05-11 18:47:10 -03:00
parent 2b47db77eb
commit 0d61eb6311
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D
5 changed files with 95 additions and 5 deletions

View file

@ -10,6 +10,7 @@ This repo is a single Python script (`luz-musica.py`) that:
- System dependency: `playerctl` must be installed and your player must expose MPRIS metadata.
- Python deps: `requests`, `Pillow`.
- Run: `python3 luz-musica.py`
- Service install: `make install-service` creates and starts a `systemd --user` unit on Ubuntu.
## Dependencies
@ -27,6 +28,12 @@ Create a venv and install Python deps:
Then run:
- `python luz-musica.py`
## Ubuntu service
- The service is installed as `~/.config/systemd/user/music-light.service`.
- The service loads optional environment overrides from `~/.config/music-light/env`.
- Use `make status-service`, `make logs-service`, `make restart-service`, and `make uninstall-service`.
- Keep it as a user service because `playerctl` needs access to the logged-in desktop user's MPRIS session.
## Configuration
Edit constants at the top of `luz-musica.py`:
- `HA_URL`, `HA_TOKEN`, `LIGHT_ENTITY`