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:
+7
-6
@@ -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
|
||||
|
||||
|
||||
+8
-2
@@ -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
|
||||
|
||||
+7
-1
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -148,6 +148,9 @@
|
||||
"hide_when_paused": {
|
||||
"label": "暂停时隐藏"
|
||||
},
|
||||
"hide_when_no_lyrics": {
|
||||
"label": "无歌词时隐藏"
|
||||
},
|
||||
"inactive_color": {
|
||||
"description": "设置未唱歌词、暂停状态和次要歌词行的颜色。",
|
||||
"label": "未唱歌词颜色"
|
||||
|
||||
Reference in New Issue
Block a user