toasts: add toast for media track change (#790)
This commit is contained in:
parent
fe4ebb79b6
commit
4cb1048fdd
3 changed files with 17 additions and 0 deletions
|
|
@ -591,6 +591,7 @@ default, you must create it manually.
|
|||
"kbLayoutChanged": true,
|
||||
"numLockChanged": true,
|
||||
"vpnChanged": true,
|
||||
"nowPlaying": false
|
||||
},
|
||||
"vpn": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ JsonObject {
|
|||
property bool numLockChanged: true
|
||||
property bool kbLayoutChanged: true
|
||||
property bool vpnChanged: true
|
||||
property bool nowPlaying: false
|
||||
}
|
||||
|
||||
component Vpn: JsonObject {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue