Skip to content

fix(spotify-lyrics): add background service and state fallback - #511

Open
goatnath wants to merge 30 commits into
noctalia-dev:mainfrom
goatnath:fix/spotify-lyrics-service-and-state
Open

fix(spotify-lyrics): add background service and state fallback#511
goatnath wants to merge 30 commits into
noctalia-dev:mainfrom
goatnath:fix/spotify-lyrics-service-and-state

Conversation

@goatnath

Copy link
Copy Markdown
Contributor

Plugin

  • Id: goatnath/spotify-lyrics
  • New plugin
  • Update to an existing plugin (version bumped in plugin.toml)

What it does

Fixes an issue where lyrics would not display in the panel/widget when the bar widget was not placed on the bar (Fixes #486).

Key changes:

  • Adds a headless [[service]] (service.luau) that starts automatically with Noctalia to bridge daemon state into noctalia.state regardless of bar configuration.
  • Adds disk-read fallback in panel.luau, widget.luau, and bar.luau.
  • Removes invalid overflow prop on ui.column to silence UI tree warnings.
  • Improves player instance matching and position parsing in spotify_lyrics_daemon.py.
  • Bumps version to 1.2.1.

External dependencies

Requires playerctl, python3, and syncedlyrics.

Testing

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Noctalia version tested against: v5.0.0
  • Plugin API level: 3

Screenshots / Videos

N/A (Bugfix / headless service update)

Checklist

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the README template, documents every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • I created thumbnail.webp with the thumbnail generator.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

Code review attestation

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

goatnath and others added 29 commits July 12, 2026 18:45
…base

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

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.
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.
- 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
- 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
  fallback, and fix ui overflow

    - Add [[service]] entry with service.luau to publish state
  independently of bar widget
    - Add direct disk state fallback in panel.luau, widget.luau, and bar.
  luau
    - Remove unsupported overflow property from ui.column
    - Enhance playerctl player detection and position parsing in daemon
    - Bump version to 1.2.1

    Fixes noctalia-dev#486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[spotify-lyrics][BUG] Lyrics not showing despite python daemon working

1 participant