feat(lyrics): Add setting to hide when no lyrics available (#216)

* feat: hide when no lyrics

* fix: bump version

* fix: missing translation + still show when track mode + readme
This commit is contained in:
nullptr
2026-08-03 22:39:58 -04:00
committed by GitHub
parent bf2058f024
commit 1583a4805f
5 changed files with 28 additions and 9 deletions
+7 -6
View File
@@ -1,4 +1,4 @@
# Noctalia Lyrics 1.4.4 # Noctalia Lyrics 1.4.5
Synchronized lyrics for the Noctalia bar, with multiple MPRIS players, Synchronized lyrics for the Noctalia bar, with multiple MPRIS players,
translation and romanization layers, configurable sources, karaoke highlighting, translation and romanization layers, configurable sources, karaoke highlighting,
@@ -62,7 +62,7 @@ noctalia msg config-reload
Run validation after every change: Run validation after every change:
```sh ```sh
python3 .github/workflows/validate-plugins.py python3 .github/workflows/scripts/validate-plugins.py
noctalia plugins lint lyrics noctalia plugins lint lyrics
sh lyrics/scripts/setup-deps.sh --check sh lyrics/scripts/setup-deps.sh --check
cd lyrics cd lyrics
@@ -136,10 +136,11 @@ milliseconds, double-line translation and romanization, karaoke highlighting,
marquee behavior, transitions, fonts, spacing, and side padding. marquee behavior, transitions, fonts, spacing, and side padding.
Per-widget settings control the fallback glyph, artist visibility, paused-state Per-widget settings control the fallback glyph, artist visibility, paused-state
visibility, album-cover shape and size, and primary, inactive, and secondary visibility, visibility when no lyrics are available, album-cover shape and size,
lyric colors. Credential and source-specific fields are shown only when their and primary, inactive, and secondary lyric colors. Credential and source-specific
matching source is selected; source order, credentials, polling, marquee fields are shown only when their matching source is selected; source order,
metrics, player filters, and fine layout controls are under Advanced settings. credentials, polling, marquee metrics, player filters, and fine layout controls
are under Advanced settings.
## Feature test checklist ## Feature test checklist
+8 -2
View File
@@ -8,6 +8,7 @@ local showGlyph = noctalia.getConfig("show_glyph")
if showGlyph == nil then showGlyph = true end if showGlyph == nil then showGlyph = true end
local showArtist = noctalia.getConfig("show_artist") local showArtist = noctalia.getConfig("show_artist")
local hideWhenPaused = noctalia.getConfig("hide_when_paused") local hideWhenPaused = noctalia.getConfig("hide_when_paused")
local hideWhenNoLyrics = noctalia.getConfig("hide_when_no_lyrics")
local showCover = noctalia.getConfig("show_cover") local showCover = noctalia.getConfig("show_cover")
if showCover == nil then showCover = true end if showCover == nil then showCover = true end
local coverShape = noctalia.getConfig("cover_shape") or "circle" local coverShape = noctalia.getConfig("cover_shape") or "circle"
@@ -142,8 +143,12 @@ local function getProgressMs()
return baselinePosition / 1000 + elapsed return baselinePosition / 1000 + elapsed
end end
local function hasLyrics()
return lyrics and #lyrics > 0 and track
end
local function getLineInfo() local function getLineInfo()
if not lyrics or #lyrics == 0 or not track then return nil end if not hasLyrics() then return nil end
local position = getProgressMs() local position = getProgressMs()
local synced = lyrics[1].time >= 0 local synced = lyrics[1].time >= 0
@@ -442,7 +447,8 @@ local function currentTransitionLine(info)
end end
local function render() local function render()
if hideWhenPaused and not playing then local showingTrack = displayMode == "track" or showMode == "track"
if hideWhenPaused and not playing or hideWhenNoLyrics and not showingTrack and not hasLyrics() then
barWidget.setVisible(false) barWidget.setVisible(false)
return return
end end
+7 -1
View File
@@ -1,6 +1,6 @@
id = "h465855hgg/lyrics" id = "h465855hgg/lyrics"
name = "Lyrics" name = "Lyrics"
version = "1.4.4" version = "1.4.5"
plugin_api = 3 plugin_api = 3
author = "h465855hgg" author = "h465855hgg"
license = "MIT" license = "MIT"
@@ -501,6 +501,12 @@ entry = "lyrics.luau"
label_key = "settings.hide_when_paused.label" label_key = "settings.hide_when_paused.label"
default = false default = false
[[widget.setting]]
key = "hide_when_no_lyrics"
type = "bool"
label_key = "settings.hide_when_no_lyrics.label"
default = false
[[widget.setting]] [[widget.setting]]
key = "show_cover" key = "show_cover"
type = "bool" type = "bool"
+3
View File
@@ -148,6 +148,9 @@
"hide_when_paused": { "hide_when_paused": {
"label": "Hide when paused" "label": "Hide when paused"
}, },
"hide_when_no_lyrics": {
"label": "Hide when no lyrics"
},
"inactive_color": { "inactive_color": {
"description": "Color used for upcoming lyrics, paused playback, and secondary lines.", "description": "Color used for upcoming lyrics, paused playback, and secondary lines.",
"label": "Inactive lyric color" "label": "Inactive lyric color"
+3
View File
@@ -148,6 +148,9 @@
"hide_when_paused": { "hide_when_paused": {
"label": "暂停时隐藏" "label": "暂停时隐藏"
}, },
"hide_when_no_lyrics": {
"label": "无歌词时隐藏"
},
"inactive_color": { "inactive_color": {
"description": "设置未唱歌词、暂停状态和次要歌词行的颜色。", "description": "设置未唱歌词、暂停状态和次要歌词行的颜色。",
"label": "未唱歌词颜色" "label": "未唱歌词颜色"