Files
community-plugins/spotify-lyrics
e439ccd102 spotify-lyrics (#214)
* Add spotify-lyrics plugin

* fix(spotify-lyrics): resolve race conditions and add plugin_api

* fix(spotify-lyrics): update plugin_api to 3

* fix(spotify-lyrics): resolve github actions validation errors

* fix(spotify-lyrics): resize thumbnail to 960x540 to fix validation error

* fix(spotify-lyrics): bump version to 1.2.1

* fix(spotify-lyrics): update namespace and replace misleading thumbnail

* fix(spotify-lyrics): declare runtime dependencies in plugin.toml and update README requirements

* feat(lyrics): implement dynamic panel width sizing

* Revert "feat(lyrics): implement dynamic panel width sizing"

This reverts commit ef91e6f9f688df7deeb41ba9e5c7606a4904b47a.

* feat(spotify-lyrics): implement dynamic panel width sizing

* fix(spotify-lyrics): correct target width pre-calculation for upcoming lines

* fix(spotify-lyrics): prevent vertical spill by enforcing maxLines=1

* fix(spotify-lyrics): implement dynamic height resizing to encapsulate wrapped text

* fix(spotify-lyrics): remove horizontal cap to prevent vertical spill

* fix(spotify-lyrics): restore minHeight and implement perfectly safe wrapping height prediction

* fix(spotify-lyrics): lock panel width and use vertical dynamic resizing exclusively

* fix(spotify-lyrics): implement dynamic font scaling and remove panel dimension animations

* fix(spotify-lyrics): restore robust dynamic height logic and discard font scaling

* refactor(spotify-lyrics): rewrite height estimation and clean up codebase

Root cause: the charUnits per-character width estimation consistently
underestimated real rendered widths because the 0.80 multipliers in
getLineWidth and getLinesCount cancelled each other out, making the
effective calculation ignore the safety margin entirely.

Fix: replaced the complex charUnits/toChars/getLineWidth machinery with
a simple #text / chars-per-line heuristic using a conservative 0.60x
character width factor. This reliably overestimates line count, ensuring
the panel always allocates enough height for wrapped text.

Quality of life improvements:
- Split monolithic render() into renderEmpty/renderPaused/renderPlaying
- Reduced update interval from 33ms (30 FPS) to 100ms (10 FPS)
- Removed file-read timer (reads every frame at lower FPS instead)
- Added clear section headers and inline documentation
- Removed all dead code (charUnits, toChars, getLineWidth, etc.)

* fix(spotify-lyrics): set panel height=280 in plugin.toml — the actual fix

The root cause of the lyrics spilling was never in the Lua code.
Noctalia panels are sized exclusively by plugin.toml, not by minHeight
on the column layout. Since we had removed width/height from plugin.toml
to make sizing 'dynamic', noctalia used a tiny default that couldn't
contain wrapped lyrics. minHeight on ui.column had zero effect on the
actual panel window size.

Set height=280 to comfortably fit 3 lyrics lines even when they wrap.

* feat(spotify-lyrics): add dynamic font scaling for long lyrics

Long lyrics (>40 chars) now get progressively smaller fonts:
- Every 15 chars beyond 40 reduces font by 2px
- Minimum font: 10px (panel) / 11px (widget)

This prevents vertical overflow regardless of container size by
ensuring long lines take up less vertical space when they wrap.

* fix(spotify-lyrics): fix plugin IDs and tilde path expansion

- Updated bar.luau to toggle correct panel ID
- Replaced ~ in noctalia.readFile with absolute path since Lua doesn't auto-expand it
- Updated plugin.toml height to 280 and id to noctalia/spotify-lyrics

* Fix UI bugs, implement reactive updates, and add album art

* Fix plugin manifest validation errors

* fix(spotify-lyrics): address PR review comments

- Change plugin id from noctalia/ to goatnath/ namespace
- Declare runtime dependencies: playerctl, python3, syncedlyrics
- Replace hardcoded /home/goatnath path with noctalia.expandPath()
- Add [[desktop_widget]] manifest entry for widget.luau
- Rewrite README to follow README_TEMPLATE.md structure
- Update all references to use corrected plugin id

---------

Co-authored-by: goatnath <aadinathkeshav1978@gmail.com>
2026-08-06 10:05:22 -04:00
..
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00
2026-08-06 10:05:22 -04:00

Spotify Lyrics

A seamless, time-synced scrolling lyrics panel for the Noctalia desktop shell. It integrates directly into your Noctalia bar and displays a beautifully formatted, auto-scrolling lyrics card — no API keys, cookies, or web scraping required.

Plugin

Field Value
ID goatnath/spotify-lyrics
Entries Bar widget: lyrics; panel: lyrics-panel; desktop widget: lyrics-desktop

Requirements

This plugin requires playerctl, python3, and the syncedlyrics Python package.

# Arch Linux
sudo pacman -S playerctl python
pip install syncedlyrics

Usage

1. Set up the Background Daemon

The daemon listens to your media player (Spotify, MPD, etc.) and fetches the lyrics.

  1. Copy the spotify_lyrics_daemon.py file to your preferred location (e.g., ~/.local/bin/).
  2. Set it up to run in the background. The recommended way is using a systemd user service:
# ~/.config/systemd/user/noctalia-lyrics.service
[Unit]
Description=Noctalia Lyrics Daemon
After=graphical-session.target

[Service]
ExecStart=/usr/bin/python3 /path/to/spotify_lyrics_daemon.py
Restart=always

[Install]
WantedBy=default.target

Start and enable the daemon:

systemctl --user daemon-reload
systemctl --user enable --now noctalia-lyrics.service

2. Enable the Plugin

  1. Install this plugin from the plugin manager or download the folder to ~/.local/share/noctalia/plugins/spotify-lyrics/.
  2. Enable the plugin via CLI:
noctalia msg plugins enable goatnath/spotify-lyrics
  1. Add the lyrics widget to your bar's layout in your ~/.local/state/noctalia/settings.toml (next to the media widget).
start = [ "launcher", "workspaces", "media", "lyrics" ]

3. Toggle the Lyrics Panel

Click the ♫ bar icon to toggle the panel, or run:

noctalia msg panel-toggle goatnath/spotify-lyrics:lyrics-panel

Notes

  • Zero Configuration: Lyrics are pulled from public databases (LRCLIB, NetEase) automatically.
  • Caching: The daemon caches lyrics and album art to ~/.cache/noctalia/lyrics/ so subsequent plays load instantly.
  • Network: The daemon makes HTTPS requests to LRCLIB and NetEase for lyrics, and to the album art URL provided by MPRIS metadata.
  • Processes: Requires a separate spotify_lyrics_daemon.py process running as a systemd user service.