diff --git a/lrc/README.md b/lrc/README.md index 1a97339..057077e 100644 --- a/lrc/README.md +++ b/lrc/README.md @@ -22,6 +22,13 @@ Enable `shin/lrc` in Settings → Plugins, then add the **LRC** bar widget. It d The widget checks MPD first, then falls back to Spotify. +## Settings + +| Key | Type | Default | Description | +| --- | --- | --- | --- | +| `show_separator` | bool | `true` | Prepend a separator before the lyric text. | +| `separator` | string | `"\| "` | Text shown before the current lyric line. | + ## Spawned processes - `playerctl` — enumerates MPRIS players and queries playback status and metadata. diff --git a/lrc/plugin.toml b/lrc/plugin.toml index fbfb2d9..6521e60 100644 --- a/lrc/plugin.toml +++ b/lrc/plugin.toml @@ -1,6 +1,6 @@ id = "shin/lrc" name = "LRC" -version = "1.0.0" +version = "1.1.0" plugin_api = 3 author = "shin" license = "MIT" @@ -10,6 +10,20 @@ description = "Displays current song lyrics via lrc_tty." tags = ["bar", "music"] dependencies = ["lrc_tty", "playerctl"] +[[setting]] +key = "show_separator" +type = "bool" +label_key = "settings.show_separator.label" +description_key = "settings.show_separator.description" +default = true + +[[setting]] +key = "separator" +type = "string" +label_key = "settings.separator.label" +description_key = "settings.separator.description" +default = "| " + [[widget]] id = "lrc" entry = "widget.luau" diff --git a/lrc/translations/en.json b/lrc/translations/en.json index 9e26dfe..7afb1cd 100644 --- a/lrc/translations/en.json +++ b/lrc/translations/en.json @@ -1 +1,12 @@ -{} \ No newline at end of file +{ + "settings": { + "show_separator": { + "label": "Show separator", + "description": "Prepend a separator before the lyric text." + }, + "separator": { + "label": "Separator", + "description": "Text shown before the current lyric line." + } + } +} diff --git a/lrc/widget.luau b/lrc/widget.luau index 8ccf726..2b79901 100644 --- a/lrc/widget.luau +++ b/lrc/widget.luau @@ -2,6 +2,8 @@ noctalia.setUpdateInterval(300) local fetching = false local mpdPlayer = "mpd" +local showSeparator = noctalia.getConfig("show_separator") ~= false +local separator = noctalia.getConfig("separator") or "| " noctalia.runAsync("playerctl -l 2>/dev/null", function(r) if r.exitCode == 0 then @@ -47,7 +49,11 @@ function fetchLyrics(player) if r.exitCode == 0 then local text = r.stdout:gsub("%s+$", "") if #text > 0 and text ~= "(no lyrics)" then - barWidget.setText("| " .. text) + local prefix = "" + if showSeparator then + prefix = separator + end + barWidget.setText(prefix .. text) return end end