1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

feat: allow adjusting notification volume (#1199)

This commit is contained in:
Eduardo Ribeiro
2025-12-29 15:41:12 +00:00
committed by GitHub
parent cffee0fae6
commit 2eeaf8ff62

View File

@@ -25,6 +25,8 @@ Singleton {
property var powerUnplugSound: null property var powerUnplugSound: null
property var normalNotificationSound: null property var normalNotificationSound: null
property var criticalNotificationSound: null property var criticalNotificationSound: null
property real notificationsVolume: 1.0
property bool notificationsAudioMuted: false
property var mediaDevices: null property var mediaDevices: null
property var mediaDevicesConnections: null property var mediaDevicesConnections: null
@@ -343,7 +345,7 @@ Singleton {
MediaPlayer { MediaPlayer {
source: "${volumeChangePath}" source: "${volumeChangePath}"
audioOutput: AudioOutput { audioOutput: AudioOutput {
${deviceProperty}volume: 1.0 ${deviceProperty}volume: notificationsVolume
} }
} }
`, root, "AudioService.VolumeChangeSound"); `, root, "AudioService.VolumeChangeSound");
@@ -355,7 +357,7 @@ Singleton {
MediaPlayer { MediaPlayer {
source: "${powerPlugPath}" source: "${powerPlugPath}"
audioOutput: AudioOutput { audioOutput: AudioOutput {
${deviceProperty}volume: 1.0 ${deviceProperty}volume: notificationsVolume
} }
} }
`, root, "AudioService.PowerPlugSound"); `, root, "AudioService.PowerPlugSound");
@@ -367,7 +369,7 @@ Singleton {
MediaPlayer { MediaPlayer {
source: "${powerUnplugPath}" source: "${powerUnplugPath}"
audioOutput: AudioOutput { audioOutput: AudioOutput {
${deviceProperty}volume: 1.0 ${deviceProperty}volume: notificationsVolume
} }
} }
`, root, "AudioService.PowerUnplugSound"); `, root, "AudioService.PowerUnplugSound");
@@ -379,7 +381,7 @@ Singleton {
MediaPlayer { MediaPlayer {
source: "${messagePath}" source: "${messagePath}"
audioOutput: AudioOutput { audioOutput: AudioOutput {
${deviceProperty}volume: 1.0 ${deviceProperty}volume: notificationsVolume
} }
} }
`, root, "AudioService.NormalNotificationSound"); `, root, "AudioService.NormalNotificationSound");
@@ -391,7 +393,7 @@ Singleton {
MediaPlayer { MediaPlayer {
source: "${messageNewInstantPath}" source: "${messageNewInstantPath}"
audioOutput: AudioOutput { audioOutput: AudioOutput {
${deviceProperty}volume: 1.0 ${deviceProperty}volume: notificationsVolume
} }
} }
`, root, "AudioService.CriticalNotificationSound"); `, root, "AudioService.CriticalNotificationSound");
@@ -401,37 +403,37 @@ Singleton {
} }
function playVolumeChangeSound() { function playVolumeChangeSound() {
if (soundsAvailable && volumeChangeSound) { if (soundsAvailable && volumeChangeSound && !notificationsAudioMuted) {
volumeChangeSound.play(); volumeChangeSound.play();
} }
} }
function playPowerPlugSound() { function playPowerPlugSound() {
if (soundsAvailable && powerPlugSound) { if (soundsAvailable && powerPlugSound && !notificationsAudioMuted) {
powerPlugSound.play(); powerPlugSound.play();
} }
} }
function playPowerUnplugSound() { function playPowerUnplugSound() {
if (soundsAvailable && powerUnplugSound) { if (soundsAvailable && powerUnplugSound && !notificationsAudioMuted) {
powerUnplugSound.play(); powerUnplugSound.play();
} }
} }
function playNormalNotificationSound() { function playNormalNotificationSound() {
if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb) { if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb && !notificationsAudioMuted) {
normalNotificationSound.play(); normalNotificationSound.play();
} }
} }
function playCriticalNotificationSound() { function playCriticalNotificationSound() {
if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb) { if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb && !notificationsAudioMuted) {
criticalNotificationSound.play(); criticalNotificationSound.play();
} }
} }
function playVolumeChangeSoundIfEnabled() { function playVolumeChangeSoundIfEnabled() {
if (SettingsData.soundsEnabled && SettingsData.soundVolumeChanged) { if (SettingsData.soundsEnabled && SettingsData.soundVolumeChanged && !notificationsAudioMuted) {
playVolumeChangeSound(); playVolumeChangeSound();
} }
} }