diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Modules/LyricsBar.qml b/config/quickshell/.config/quickshell/Modules/Bar/Modules/LyricsBar.qml index fe21e56..bf7a2e5 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Modules/LyricsBar.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Modules/LyricsBar.qml @@ -25,7 +25,7 @@ Rectangle { clip: true UText { - text: LyricsService.lyrics.get(LyricsService.currentIndex)?.line || "" + text: LyricsService.isFetchingLyrics ? "Fetching..." : (LyricsService.lyrics.get(LyricsService.currentIndex)?.line ?? "No lyrics available") family: Fonts.sans pointSize: Style.fontSizeM maximumLineCount: 1 diff --git a/config/quickshell/.config/quickshell/Modules/Sidebar/Modules/LyricsCard.qml b/config/quickshell/.config/quickshell/Modules/Sidebar/Modules/LyricsCard.qml index c619757..4c94843 100644 --- a/config/quickshell/.config/quickshell/Modules/Sidebar/Modules/LyricsCard.qml +++ b/config/quickshell/.config/quickshell/Modules/Sidebar/Modules/LyricsCard.qml @@ -16,6 +16,13 @@ UBox { LyricsService.unregisterComponent("LyricsCard"); } + UText { + anchors.centerIn: parent + visible: LyricsService.isFetchingLyrics || LyricsService.lyrics.count === 0 + text: LyricsService.isFetchingLyrics ? "Fetching..." : "No lyrics available" + color: Colors.mOnSurfaceVariant + } + ListView { id: lyricsList @@ -25,6 +32,7 @@ UBox { model: LyricsService.lyrics currentIndex: LyricsService.currentIndex clip: true + visible: !LyricsService.isFetchingLyrics && LyricsService.lyrics.count > 0 onCurrentIndexChanged: { if (currentIndex >= 0) positionViewAtIndex(currentIndex, ListView.Center); diff --git a/config/quickshell/.config/quickshell/Services/LyricsService.qml b/config/quickshell/.config/quickshell/Services/LyricsService.qml index 0620fd1..58d2612 100644 --- a/config/quickshell/.config/quickshell/Services/LyricsService.qml +++ b/config/quickshell/.config/quickshell/Services/LyricsService.qml @@ -23,7 +23,8 @@ Singleton { property var _registered: ({ }) readonly property int _registeredCount: Object.keys(_registered).length - readonly property bool shouldRun: _registeredCount > 0 + readonly property bool shouldRun: MediaService.currentPlayer && _registeredCount > 0 + // readonly property bool shouldRun: MediaService.currentPlayer !== null // Bar state readonly property bool showLyricsBar: ShellState.lyricsState.showLyricsBar || false @@ -58,21 +59,19 @@ Singleton { return ; root.isFetchingLyrics = true; - if (!MediaService.currentPlayer) { + if (!MediaService.currentPlayer?.identity) { root.isFetchingLyrics = false; return ; - } else if (MediaService.currentPlayer.identity.toLowerCase() === "spotify") - lyricsProcess.request("spotify"); - else if (MediaService.currentPlayer.identity.toLowerCase() === "elisa") - lyricsProcess.request("elisa"); - else - root.isFetchingLyrics = false; + } else { + lyricsProcess.request(MediaService.currentPlayer.identity.toLowerCase()); + } } function parseLRC(text) { if (!root.shouldRun) return ; + // Logger.d("Lyrics", "Parsing :\n" + text); const lines = text.split("\n"); let newLyrics = []; for (let i = 0; i < lines.length; i++) { @@ -165,7 +164,8 @@ Singleton { Logger.d("Lyrics", "Should run changed:", root.shouldRun); if (!root.shouldRun) { root.lyrics.clear(); - root.isFetchingLyrics = false; + root.lyricsUpdated(); + root.currentIndex = -1; } else { root._requestFetchLyrics(); } @@ -229,15 +229,7 @@ Singleton { } const player = this.queuedPlayer.toLowerCase(); this.queuedPlayer = ""; - if (player === "spotify") { - this.command = ["lrcfetch", "fetch", "--player", "spotify"]; - } else if (player === "elisa") { - this.command = ["lrcfetch", "fetch", "--player", "elisa"]; - } else { - root.isFetchingLyrics = false; - root.parseLRC(""); - return ; - } + this.command = ["lrcfetch", "fetch", "--player", player]; this.running = true; } diff --git a/config/shell/.config/fish/completions/.gitignore b/config/shell/.config/fish/completions/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/config/shell/.config/fish/completions/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore