diff --git a/lyrics/README.md b/lyrics/README.md index b3a8eb2..70db384 100644 --- a/lyrics/README.md +++ b/lyrics/README.md @@ -1,4 +1,4 @@ -# Noctalia Lyrics 1.4.4 +# Noctalia Lyrics 1.4.5 Synchronized lyrics for the Noctalia bar, with multiple MPRIS players, translation and romanization layers, configurable sources, karaoke highlighting, @@ -62,7 +62,7 @@ noctalia msg config-reload Run validation after every change: ```sh -python3 .github/workflows/validate-plugins.py +python3 .github/workflows/scripts/validate-plugins.py noctalia plugins lint lyrics sh lyrics/scripts/setup-deps.sh --check cd lyrics @@ -136,10 +136,11 @@ milliseconds, double-line translation and romanization, karaoke highlighting, marquee behavior, transitions, fonts, spacing, and side padding. Per-widget settings control the fallback glyph, artist visibility, paused-state -visibility, album-cover shape and size, and primary, inactive, and secondary -lyric colors. Credential and source-specific fields are shown only when their -matching source is selected; source order, credentials, polling, marquee -metrics, player filters, and fine layout controls are under Advanced settings. +visibility, visibility when no lyrics are available, album-cover shape and size, +and primary, inactive, and secondary lyric colors. Credential and source-specific +fields are shown only when their matching source is selected; source order, +credentials, polling, marquee metrics, player filters, and fine layout controls +are under Advanced settings. ## Feature test checklist diff --git a/lyrics/lyrics.luau b/lyrics/lyrics.luau index 37e6ae0..5a54950 100644 --- a/lyrics/lyrics.luau +++ b/lyrics/lyrics.luau @@ -8,6 +8,7 @@ local showGlyph = noctalia.getConfig("show_glyph") if showGlyph == nil then showGlyph = true end local showArtist = noctalia.getConfig("show_artist") local hideWhenPaused = noctalia.getConfig("hide_when_paused") +local hideWhenNoLyrics = noctalia.getConfig("hide_when_no_lyrics") local showCover = noctalia.getConfig("show_cover") if showCover == nil then showCover = true end local coverShape = noctalia.getConfig("cover_shape") or "circle" @@ -142,8 +143,12 @@ local function getProgressMs() return baselinePosition / 1000 + elapsed end +local function hasLyrics() + return lyrics and #lyrics > 0 and track +end + 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 synced = lyrics[1].time >= 0 @@ -442,7 +447,8 @@ local function currentTransitionLine(info) end 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) return end diff --git a/lyrics/plugin.toml b/lyrics/plugin.toml index b6ed713..dd7d785 100644 --- a/lyrics/plugin.toml +++ b/lyrics/plugin.toml @@ -1,6 +1,6 @@ id = "h465855hgg/lyrics" name = "Lyrics" -version = "1.4.4" +version = "1.4.5" plugin_api = 3 author = "h465855hgg" license = "MIT" @@ -501,6 +501,12 @@ entry = "lyrics.luau" label_key = "settings.hide_when_paused.label" default = false + [[widget.setting]] + key = "hide_when_no_lyrics" + type = "bool" + label_key = "settings.hide_when_no_lyrics.label" + default = false + [[widget.setting]] key = "show_cover" type = "bool" diff --git a/lyrics/translations/en.json b/lyrics/translations/en.json index 22c63e9..4bafd20 100644 --- a/lyrics/translations/en.json +++ b/lyrics/translations/en.json @@ -148,6 +148,9 @@ "hide_when_paused": { "label": "Hide when paused" }, + "hide_when_no_lyrics": { + "label": "Hide when no lyrics" + }, "inactive_color": { "description": "Color used for upcoming lyrics, paused playback, and secondary lines.", "label": "Inactive lyric color" diff --git a/lyrics/translations/zh-Hans.json b/lyrics/translations/zh-Hans.json index 3085563..0cbf49c 100644 --- a/lyrics/translations/zh-Hans.json +++ b/lyrics/translations/zh-Hans.json @@ -148,6 +148,9 @@ "hide_when_paused": { "label": "暂停时隐藏" }, + "hide_when_no_lyrics": { + "label": "无歌词时隐藏" + }, "inactive_color": { "description": "设置未唱歌词、暂停状态和次要歌词行的颜色。", "label": "未唱歌词颜色"