1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 15:32:50 -05:00

sounds: make qt6-multimedia optional

This commit is contained in:
bbedward
2025-10-14 07:58:16 -04:00
parent 692b45c4f0
commit ea56fb5840
5 changed files with 129 additions and 48 deletions

View File

@@ -3,7 +3,6 @@ pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import QtMultimedia
import Quickshell
import Quickshell.Io
import Quickshell.Services.UPower
@@ -23,22 +22,6 @@ Singleton {
onTriggered: root.suppressSound = false
}
MediaPlayer {
id: powerPlugSound
source: Qt.resolvedUrl("../assets/sounds/plasma/power-plug.ogg")
audioOutput: AudioOutput {
volume: 1.0
}
}
MediaPlayer {
id: powerUnplugSound
source: Qt.resolvedUrl("../assets/sounds/plasma/power-unplug.ogg")
audioOutput: AudioOutput {
volume: 1.0
}
}
readonly property string preferredBatteryOverride: Quickshell.env("DMS_PREFERRED_BATTERY")
readonly property UPowerDevice device: {
@@ -62,9 +45,9 @@ Singleton {
if (SettingsData.soundsEnabled && SettingsData.soundPluggedIn) {
if (isPluggedIn && !previousPluggedState) {
powerPlugSound.play()
AudioService.playPowerPlugSound()
} else if (!isPluggedIn && previousPluggedState) {
powerUnplugSound.play()
AudioService.playPowerUnplugSound()
}
}