Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions services/Players.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma Singleton

import QtQuick
import QtQml
import Quickshell
import Quickshell.Io
Expand All @@ -25,14 +26,27 @@ Singleton {
if (!Config.utilities.toasts.nowPlaying) {
return;
}
if (root.active.trackArtist != "" && root.active.trackTitle != "") {
Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(root.active.trackArtist).arg(root.active.trackTitle), "music_note");
}
nowPlayingTimer.restart();
}

target: root.active
}
Comment thread
endafk marked this conversation as resolved.

// Debounce the now playing toast to avoid showing stale metadata.
// Some players (e.g. Spotify) emit postTrackChanged as soon as the track
// ID changes, before the title/artist properties are updated in a follow-up
// D-Bus signal. Waiting a short time ensures the metadata has settled.
Timer {
id: nowPlayingTimer

interval: 300
onTriggered: {
Comment thread
endafk marked this conversation as resolved.
if (root.active && root.active.trackArtist != "" && root.active.trackTitle != "") {
Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(root.active.trackArtist).arg(root.active.trackTitle), "music_note");
}
}
}

PersistentProperties {
id: props

Expand Down