From 2eeaf8ff624ff095efa934e621e7b5ba6e9de618 Mon Sep 17 00:00:00 2001 From: Eduardo Ribeiro <43757249+EDUnter@users.noreply.github.com> Date: Mon, 29 Dec 2025 15:41:12 +0000 Subject: [PATCH] feat: allow adjusting notification volume (#1199) --- quickshell/Services/AudioService.qml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/quickshell/Services/AudioService.qml b/quickshell/Services/AudioService.qml index 3dff34f6..6f0a5c20 100644 --- a/quickshell/Services/AudioService.qml +++ b/quickshell/Services/AudioService.qml @@ -25,6 +25,8 @@ Singleton { property var powerUnplugSound: null property var normalNotificationSound: null property var criticalNotificationSound: null + property real notificationsVolume: 1.0 + property bool notificationsAudioMuted: false property var mediaDevices: null property var mediaDevicesConnections: null @@ -343,7 +345,7 @@ Singleton { MediaPlayer { source: "${volumeChangePath}" audioOutput: AudioOutput { - ${deviceProperty}volume: 1.0 + ${deviceProperty}volume: notificationsVolume } } `, root, "AudioService.VolumeChangeSound"); @@ -355,7 +357,7 @@ Singleton { MediaPlayer { source: "${powerPlugPath}" audioOutput: AudioOutput { - ${deviceProperty}volume: 1.0 + ${deviceProperty}volume: notificationsVolume } } `, root, "AudioService.PowerPlugSound"); @@ -367,7 +369,7 @@ Singleton { MediaPlayer { source: "${powerUnplugPath}" audioOutput: AudioOutput { - ${deviceProperty}volume: 1.0 + ${deviceProperty}volume: notificationsVolume } } `, root, "AudioService.PowerUnplugSound"); @@ -379,7 +381,7 @@ Singleton { MediaPlayer { source: "${messagePath}" audioOutput: AudioOutput { - ${deviceProperty}volume: 1.0 + ${deviceProperty}volume: notificationsVolume } } `, root, "AudioService.NormalNotificationSound"); @@ -391,7 +393,7 @@ Singleton { MediaPlayer { source: "${messageNewInstantPath}" audioOutput: AudioOutput { - ${deviceProperty}volume: 1.0 + ${deviceProperty}volume: notificationsVolume } } `, root, "AudioService.CriticalNotificationSound"); @@ -401,37 +403,37 @@ Singleton { } function playVolumeChangeSound() { - if (soundsAvailable && volumeChangeSound) { + if (soundsAvailable && volumeChangeSound && !notificationsAudioMuted) { volumeChangeSound.play(); } } function playPowerPlugSound() { - if (soundsAvailable && powerPlugSound) { + if (soundsAvailable && powerPlugSound && !notificationsAudioMuted) { powerPlugSound.play(); } } function playPowerUnplugSound() { - if (soundsAvailable && powerUnplugSound) { + if (soundsAvailable && powerUnplugSound && !notificationsAudioMuted) { powerUnplugSound.play(); } } function playNormalNotificationSound() { - if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb) { + if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb && !notificationsAudioMuted) { normalNotificationSound.play(); } } function playCriticalNotificationSound() { - if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb) { + if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb && !notificationsAudioMuted) { criticalNotificationSound.play(); } } function playVolumeChangeSoundIfEnabled() { - if (SettingsData.soundsEnabled && SettingsData.soundVolumeChanged) { + if (SettingsData.soundsEnabled && SettingsData.soundVolumeChanged && !notificationsAudioMuted) { playVolumeChangeSound(); } }