diff --git a/README.md b/README.md index 59728218..747c2d97 100644 --- a/README.md +++ b/README.md @@ -591,6 +591,7 @@ default, you must create it manually. "kbLayoutChanged": true, "numLockChanged": true, "vpnChanged": true, + "nowPlaying": false }, "vpn": { "enabled": false, diff --git a/config/UtilitiesConfig.qml b/config/UtilitiesConfig.qml index 0c480341..5779d882 100644 --- a/config/UtilitiesConfig.qml +++ b/config/UtilitiesConfig.qml @@ -24,6 +24,7 @@ JsonObject { property bool numLockChanged: true property bool kbLayoutChanged: true property bool vpnChanged: true + property bool nowPlaying: false } component Vpn: JsonObject { diff --git a/services/Players.qml b/services/Players.qml index 22aab3f7..1191696a 100644 --- a/services/Players.qml +++ b/services/Players.qml @@ -5,6 +5,8 @@ import qs.config import Quickshell import Quickshell.Io import Quickshell.Services.Mpris +import QtQml +import Caelestia Singleton { id: root @@ -18,6 +20,19 @@ Singleton { return alias?.to ?? player.identity; } + Connections { + target: active + + function onPostTrackChanged() { + if (!Config.utilities.toasts.nowPlaying) { + return; + } + if (active.trackArtist != "" && active.trackTitle != "") { + Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(active.trackArtist).arg(active.trackTitle), "music_note"); + } + } + } + PersistentProperties { id: props