Add support for notification sound effects

This commit is contained in:
miruka
2021-02-28 13:59:36 -04:00
parent 1b0bec3470
commit 99325fde86
6 changed files with 37 additions and 11 deletions

View File

@@ -26,6 +26,11 @@ QtObject {
if (bubble)
py.callCoro("desktop_notify", [title, body, image])
if (sound) {
window.mainUI.defaultNotificationSound.seek(0)
window.mainUI.defaultNotificationSound.play()
}
if (urgencyHint) {
const msec =
critical ?

View File

@@ -6,6 +6,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import QtGraphicalEffects 1.12
import QtMultimedia 5.12
import "."
import "Base"
import "MainPane"
@@ -35,6 +36,7 @@ Item {
return ids
}
readonly property alias defaultNotificationSound: defaultNotificationSound
readonly property alias debugConsole: debugConsole
readonly property alias mainPane: mainPane
readonly property alias pageLoader: pageLoader
@@ -114,16 +116,27 @@ Item {
font.pointSize: -1
}
DebugConsole {
id: debugConsole
target: mainUI
visible: false
Audio {
id: defaultNotificationSound
readonly property string sfx:
window.settings.Notifications.default_sound
audioRole: Audio.NotificationRole
volume: window.settings.Notifications.volume / 100
source: sfx.trim() === "default.wav" ? "../sounds/default.wav" : sfx
}
IdleManager {
id: idleManager
}
DebugConsole {
id: debugConsole
target: mainUI
visible: false
}
LinearGradient {
id: mainUIGradient
visible: ! image.visible