mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
sounds: option to override system sound themes
This commit is contained in:
@@ -168,6 +168,7 @@ Singleton {
|
|||||||
onNotepadLastCustomTransparencyChanged: saveSettings()
|
onNotepadLastCustomTransparencyChanged: saveSettings()
|
||||||
|
|
||||||
property bool soundsEnabled: true
|
property bool soundsEnabled: true
|
||||||
|
property bool useSystemSoundTheme: false
|
||||||
property bool soundNewNotification: true
|
property bool soundNewNotification: true
|
||||||
property bool soundVolumeChanged: true
|
property bool soundVolumeChanged: true
|
||||||
property bool soundPluggedIn: true
|
property bool soundPluggedIn: true
|
||||||
@@ -416,6 +417,7 @@ Singleton {
|
|||||||
notepadTransparencyOverride = settings.notepadTransparencyOverride !== undefined ? settings.notepadTransparencyOverride : -1
|
notepadTransparencyOverride = settings.notepadTransparencyOverride !== undefined ? settings.notepadTransparencyOverride : -1
|
||||||
notepadLastCustomTransparency = settings.notepadLastCustomTransparency !== undefined ? settings.notepadLastCustomTransparency : 0.95
|
notepadLastCustomTransparency = settings.notepadLastCustomTransparency !== undefined ? settings.notepadLastCustomTransparency : 0.95
|
||||||
soundsEnabled = settings.soundsEnabled !== undefined ? settings.soundsEnabled : true
|
soundsEnabled = settings.soundsEnabled !== undefined ? settings.soundsEnabled : true
|
||||||
|
useSystemSoundTheme = settings.useSystemSoundTheme !== undefined ? settings.useSystemSoundTheme : false
|
||||||
soundNewNotification = settings.soundNewNotification !== undefined ? settings.soundNewNotification : true
|
soundNewNotification = settings.soundNewNotification !== undefined ? settings.soundNewNotification : true
|
||||||
soundVolumeChanged = settings.soundVolumeChanged !== undefined ? settings.soundVolumeChanged : true
|
soundVolumeChanged = settings.soundVolumeChanged !== undefined ? settings.soundVolumeChanged : true
|
||||||
soundPluggedIn = settings.soundPluggedIn !== undefined ? settings.soundPluggedIn : true
|
soundPluggedIn = settings.soundPluggedIn !== undefined ? settings.soundPluggedIn : true
|
||||||
@@ -582,6 +584,7 @@ Singleton {
|
|||||||
"notepadTransparencyOverride": notepadTransparencyOverride,
|
"notepadTransparencyOverride": notepadTransparencyOverride,
|
||||||
"notepadLastCustomTransparency": notepadLastCustomTransparency,
|
"notepadLastCustomTransparency": notepadLastCustomTransparency,
|
||||||
"soundsEnabled": soundsEnabled,
|
"soundsEnabled": soundsEnabled,
|
||||||
|
"useSystemSoundTheme": useSystemSoundTheme,
|
||||||
"soundNewNotification": soundNewNotification,
|
"soundNewNotification": soundNewNotification,
|
||||||
"soundVolumeChanged": soundVolumeChanged,
|
"soundVolumeChanged": soundVolumeChanged,
|
||||||
"soundPluggedIn": soundPluggedIn,
|
"soundPluggedIn": soundPluggedIn,
|
||||||
@@ -677,7 +680,7 @@ Singleton {
|
|||||||
"fontWeight", "fontScale", "dankBarFontScale", "notepadUseMonospace",
|
"fontWeight", "fontScale", "dankBarFontScale", "notepadUseMonospace",
|
||||||
"notepadFontFamily", "notepadFontSize", "notepadShowLineNumbers",
|
"notepadFontFamily", "notepadFontSize", "notepadShowLineNumbers",
|
||||||
"notepadTransparencyOverride", "notepadLastCustomTransparency", "soundsEnabled",
|
"notepadTransparencyOverride", "notepadLastCustomTransparency", "soundsEnabled",
|
||||||
"soundNewNotification", "soundVolumeChanged", "soundPluggedIn", "gtkThemingEnabled",
|
"useSystemSoundTheme", "soundNewNotification", "soundVolumeChanged", "soundPluggedIn", "gtkThemingEnabled",
|
||||||
"qtThemingEnabled", "showDock", "dockAutoHide", "dockGroupByApp",
|
"qtThemingEnabled", "showDock", "dockAutoHide", "dockGroupByApp",
|
||||||
"dockOpenOnOverview", "dockPosition", "dockSpacing", "dockBottomGap",
|
"dockOpenOnOverview", "dockPosition", "dockSpacing", "dockBottomGap",
|
||||||
"cornerRadius", "notificationOverlayEnabled", "dankBarAutoHide",
|
"cornerRadius", "notificationOverlayEnabled", "dankBarAutoHide",
|
||||||
@@ -1363,6 +1366,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setUseSystemSoundTheme(enabled) {
|
||||||
|
useSystemSoundTheme = enabled
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setSoundNewNotification(enabled) {
|
function setSoundNewNotification(enabled) {
|
||||||
soundNewNotification = enabled
|
soundNewNotification = enabled
|
||||||
saveSettings()
|
saveSettings()
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ Item {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
WallpaperCyclingService.cyclingActive
|
WallpaperCyclingService.cyclingActive
|
||||||
fontEnumerationTimer.start()
|
fontEnumerationTimer.start()
|
||||||
|
if (AudioService.gsettingsAvailable) {
|
||||||
|
AudioService.scanSoundThemes()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankFlickable {
|
DankFlickable {
|
||||||
@@ -1263,6 +1266,72 @@ Item {
|
|||||||
opacity: 0.2
|
opacity: 0.2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width - parent.leftPadding
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
visible: AudioService.gsettingsAvailable
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width - useSystemSoundThemeToggle.width - Theme.spacingM
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Use System Theme")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Use sound theme from system settings")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
id: useSystemSoundThemeToggle
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
checked: SettingsData.useSystemSoundTheme
|
||||||
|
onToggled: checked => {
|
||||||
|
SettingsData.setUseSystemSoundTheme(checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankDropdown {
|
||||||
|
id: soundThemeDropdown
|
||||||
|
|
||||||
|
width: parent.width - parent.leftPadding
|
||||||
|
text: I18n.tr("Sound Theme")
|
||||||
|
description: I18n.tr("Select system sound theme")
|
||||||
|
visible: SettingsData.useSystemSoundTheme && AudioService.availableSoundThemes.length > 0
|
||||||
|
enabled: SettingsData.useSystemSoundTheme && AudioService.availableSoundThemes.length > 0
|
||||||
|
options: AudioService.availableSoundThemes
|
||||||
|
currentValue: {
|
||||||
|
const theme = AudioService.currentSoundTheme
|
||||||
|
if (theme && AudioService.availableSoundThemes.includes(theme)) {
|
||||||
|
return theme
|
||||||
|
}
|
||||||
|
return AudioService.availableSoundThemes.length > 0 ? AudioService.availableSoundThemes[0] : ""
|
||||||
|
}
|
||||||
|
onValueChanged: value => {
|
||||||
|
if (value && value !== AudioService.currentSoundTheme) {
|
||||||
|
AudioService.setSoundTheme(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width - parent.leftPadding
|
||||||
|
height: 1
|
||||||
|
color: Theme.outline
|
||||||
|
opacity: 0.2
|
||||||
|
visible: AudioService.gsettingsAvailable
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
width: parent.width - parent.leftPadding
|
width: parent.width - parent.leftPadding
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ Singleton {
|
|||||||
|
|
||||||
property bool suppressOSD: true
|
property bool suppressOSD: true
|
||||||
property bool soundsAvailable: false
|
property bool soundsAvailable: false
|
||||||
|
property bool gsettingsAvailable: false
|
||||||
|
property var availableSoundThemes: []
|
||||||
|
property string currentSoundTheme: ""
|
||||||
|
property var soundFilePaths: ({})
|
||||||
|
|
||||||
property var volumeChangeSound: null
|
property var volumeChangeSound: null
|
||||||
property var powerPlugSound: null
|
property var powerPlugSound: null
|
||||||
@@ -51,53 +55,266 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkGsettings() {
|
||||||
|
Proc.runCommand("checkGsettings", ["sh", "-c", "gsettings get org.gnome.desktop.sound theme-name 2>/dev/null"], (output, exitCode) => {
|
||||||
|
gsettingsAvailable = (exitCode === 0)
|
||||||
|
if (gsettingsAvailable) {
|
||||||
|
scanSoundThemes()
|
||||||
|
getCurrentSoundTheme()
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanSoundThemes() {
|
||||||
|
const xdgDataDirs = Quickshell.env("XDG_DATA_DIRS")
|
||||||
|
const searchPaths = xdgDataDirs && xdgDataDirs.trim() !== ""
|
||||||
|
? xdgDataDirs.split(":")
|
||||||
|
: ["/usr/share", "/usr/local/share", StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/.local/share"]
|
||||||
|
|
||||||
|
const basePaths = searchPaths.map(p => p + "/sounds").join(" ")
|
||||||
|
const script = `
|
||||||
|
for base_dir in ${basePaths}; do
|
||||||
|
[ -d "$base_dir" ] || continue
|
||||||
|
for theme_dir in "$base_dir"/*; do
|
||||||
|
[ -d "$theme_dir/stereo" ] || continue
|
||||||
|
basename "$theme_dir"
|
||||||
|
done
|
||||||
|
done | sort -u
|
||||||
|
`
|
||||||
|
|
||||||
|
Proc.runCommand("scanSoundThemes", ["sh", "-c", script], (output, exitCode) => {
|
||||||
|
if (exitCode === 0 && output.trim()) {
|
||||||
|
const themes = output.trim().split('\n').filter(t => t && t.length > 0)
|
||||||
|
availableSoundThemes = themes
|
||||||
|
} else {
|
||||||
|
availableSoundThemes = []
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentSoundTheme() {
|
||||||
|
Proc.runCommand("getCurrentSoundTheme", ["sh", "-c", "gsettings get org.gnome.desktop.sound theme-name 2>/dev/null | sed \"s/'//g\""], (output, exitCode) => {
|
||||||
|
if (exitCode === 0 && output.trim()) {
|
||||||
|
currentSoundTheme = output.trim()
|
||||||
|
console.log("AudioService: Current system sound theme:", currentSoundTheme)
|
||||||
|
if (SettingsData.useSystemSoundTheme) {
|
||||||
|
discoverSoundFiles(currentSoundTheme)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
currentSoundTheme = ""
|
||||||
|
console.log("AudioService: No system sound theme found")
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSoundTheme(themeName) {
|
||||||
|
if (!themeName || themeName === currentSoundTheme) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Proc.runCommand("setSoundTheme", ["sh", "-c", `gsettings set org.gnome.desktop.sound theme-name '${themeName}'`], (output, exitCode) => {
|
||||||
|
if (exitCode === 0) {
|
||||||
|
currentSoundTheme = themeName
|
||||||
|
if (SettingsData.useSystemSoundTheme) {
|
||||||
|
discoverSoundFiles(themeName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function discoverSoundFiles(themeName) {
|
||||||
|
if (!themeName) {
|
||||||
|
soundFilePaths = {}
|
||||||
|
if (soundsAvailable) {
|
||||||
|
destroySoundPlayers()
|
||||||
|
createSoundPlayers()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const xdgDataDirs = Quickshell.env("XDG_DATA_DIRS")
|
||||||
|
const searchPaths = xdgDataDirs && xdgDataDirs.trim() !== ""
|
||||||
|
? xdgDataDirs.split(":")
|
||||||
|
: ["/usr/share", "/usr/local/share", StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/.local/share"]
|
||||||
|
|
||||||
|
const extensions = ["oga", "ogg", "wav", "mp3", "flac"]
|
||||||
|
const themesToSearch = themeName !== "freedesktop" ? `${themeName} freedesktop` : themeName
|
||||||
|
|
||||||
|
const script = `
|
||||||
|
for event_key in audio-volume-change power-plug power-unplug message message-new-instant; do
|
||||||
|
found=0
|
||||||
|
|
||||||
|
case "$event_key" in
|
||||||
|
message)
|
||||||
|
names="dialog-information message message-lowpriority bell"
|
||||||
|
;;
|
||||||
|
message-new-instant)
|
||||||
|
names="dialog-warning message-new-instant message-highlight"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
names="$event_key"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for theme in ${themesToSearch}; do
|
||||||
|
for event_name in $names; do
|
||||||
|
for base_path in ${searchPaths.join(" ")}; do
|
||||||
|
sounds_path="$base_path/sounds"
|
||||||
|
for ext in ${extensions.join(" ")}; do
|
||||||
|
file_path="$sounds_path/$theme/stereo/$event_name.$ext"
|
||||||
|
if [ -f "$file_path" ]; then
|
||||||
|
echo "$event_key=$file_path"
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ $found -eq 1 ] && break
|
||||||
|
done
|
||||||
|
[ $found -eq 1 ] && break
|
||||||
|
done
|
||||||
|
[ $found -eq 1 ] && break
|
||||||
|
done
|
||||||
|
done
|
||||||
|
`
|
||||||
|
|
||||||
|
Proc.runCommand("discoverSoundFiles", ["sh", "-c", script], (output, exitCode) => {
|
||||||
|
const paths = {}
|
||||||
|
if (exitCode === 0 && output.trim()) {
|
||||||
|
const lines = output.trim().split('\n')
|
||||||
|
for (let line of lines) {
|
||||||
|
const parts = line.split('=')
|
||||||
|
if (parts.length === 2) {
|
||||||
|
paths[parts[0]] = "file://" + parts[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
soundFilePaths = paths
|
||||||
|
|
||||||
|
if (soundsAvailable) {
|
||||||
|
destroySoundPlayers()
|
||||||
|
createSoundPlayers()
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSoundPath(soundEvent) {
|
||||||
|
const soundMap = {
|
||||||
|
"audio-volume-change": "../assets/sounds/freedesktop/audio-volume-change.wav",
|
||||||
|
"power-plug": "../assets/sounds/plasma/power-plug.wav",
|
||||||
|
"power-unplug": "../assets/sounds/plasma/power-unplug.wav",
|
||||||
|
"message": "../assets/sounds/freedesktop/message.wav",
|
||||||
|
"message-new-instant": "../assets/sounds/freedesktop/message-new-instant.wav"
|
||||||
|
}
|
||||||
|
|
||||||
|
const specialConditions = {
|
||||||
|
"smooth": ["audio-volume-change"]
|
||||||
|
}
|
||||||
|
|
||||||
|
const themeLower = currentSoundTheme.toLowerCase()
|
||||||
|
if (SettingsData.useSystemSoundTheme && specialConditions[themeLower]?.includes(soundEvent)) {
|
||||||
|
const bundledPath = Qt.resolvedUrl(soundMap[soundEvent] || "../assets/sounds/freedesktop/message.wav")
|
||||||
|
console.log("AudioService: Using bundled sound (special condition) for", soundEvent, ":", bundledPath)
|
||||||
|
return bundledPath
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SettingsData.useSystemSoundTheme && soundFilePaths[soundEvent]) {
|
||||||
|
console.log("AudioService: Using system sound for", soundEvent, ":", soundFilePaths[soundEvent])
|
||||||
|
return soundFilePaths[soundEvent]
|
||||||
|
}
|
||||||
|
|
||||||
|
const bundledPath = Qt.resolvedUrl(soundMap[soundEvent] || "../assets/sounds/freedesktop/message.wav")
|
||||||
|
console.log("AudioService: Using bundled sound for", soundEvent, ":", bundledPath)
|
||||||
|
return bundledPath
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadSounds() {
|
||||||
|
console.log("AudioService: Reloading sounds, useSystemSoundTheme:", SettingsData.useSystemSoundTheme, "currentSoundTheme:", currentSoundTheme)
|
||||||
|
if (SettingsData.useSystemSoundTheme && currentSoundTheme) {
|
||||||
|
discoverSoundFiles(currentSoundTheme)
|
||||||
|
} else {
|
||||||
|
soundFilePaths = {}
|
||||||
|
if (soundsAvailable) {
|
||||||
|
destroySoundPlayers()
|
||||||
|
createSoundPlayers()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroySoundPlayers() {
|
||||||
|
if (volumeChangeSound) {
|
||||||
|
volumeChangeSound.destroy()
|
||||||
|
volumeChangeSound = null
|
||||||
|
}
|
||||||
|
if (powerPlugSound) {
|
||||||
|
powerPlugSound.destroy()
|
||||||
|
powerPlugSound = null
|
||||||
|
}
|
||||||
|
if (powerUnplugSound) {
|
||||||
|
powerUnplugSound.destroy()
|
||||||
|
powerUnplugSound = null
|
||||||
|
}
|
||||||
|
if (normalNotificationSound) {
|
||||||
|
normalNotificationSound.destroy()
|
||||||
|
normalNotificationSound = null
|
||||||
|
}
|
||||||
|
if (criticalNotificationSound) {
|
||||||
|
criticalNotificationSound.destroy()
|
||||||
|
criticalNotificationSound = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createSoundPlayers() {
|
function createSoundPlayers() {
|
||||||
if (!soundsAvailable) {
|
if (!soundsAvailable) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const volumeChangePath = getSoundPath("audio-volume-change")
|
||||||
volumeChangeSound = Qt.createQmlObject(`
|
volumeChangeSound = Qt.createQmlObject(`
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
source: Qt.resolvedUrl("../assets/sounds/freedesktop/audio-volume-change.wav")
|
source: "${volumeChangePath}"
|
||||||
audioOutput: AudioOutput { volume: 1.0 }
|
audioOutput: AudioOutput { volume: 1.0 }
|
||||||
}
|
}
|
||||||
`, root, "AudioService.VolumeChangeSound")
|
`, root, "AudioService.VolumeChangeSound")
|
||||||
|
|
||||||
|
const powerPlugPath = getSoundPath("power-plug")
|
||||||
powerPlugSound = Qt.createQmlObject(`
|
powerPlugSound = Qt.createQmlObject(`
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
source: Qt.resolvedUrl("../assets/sounds/plasma/power-plug.wav")
|
source: "${powerPlugPath}"
|
||||||
audioOutput: AudioOutput { volume: 1.0 }
|
audioOutput: AudioOutput { volume: 1.0 }
|
||||||
}
|
}
|
||||||
`, root, "AudioService.PowerPlugSound")
|
`, root, "AudioService.PowerPlugSound")
|
||||||
|
|
||||||
|
const powerUnplugPath = getSoundPath("power-unplug")
|
||||||
powerUnplugSound = Qt.createQmlObject(`
|
powerUnplugSound = Qt.createQmlObject(`
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
source: Qt.resolvedUrl("../assets/sounds/plasma/power-unplug.wav")
|
source: "${powerUnplugPath}"
|
||||||
audioOutput: AudioOutput { volume: 1.0 }
|
audioOutput: AudioOutput { volume: 1.0 }
|
||||||
}
|
}
|
||||||
`, root, "AudioService.PowerUnplugSound")
|
`, root, "AudioService.PowerUnplugSound")
|
||||||
|
|
||||||
|
const messagePath = getSoundPath("message")
|
||||||
normalNotificationSound = Qt.createQmlObject(`
|
normalNotificationSound = Qt.createQmlObject(`
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
source: Qt.resolvedUrl("../assets/sounds/freedesktop/message.wav")
|
source: "${messagePath}"
|
||||||
audioOutput: AudioOutput { volume: 1.0 }
|
audioOutput: AudioOutput { volume: 1.0 }
|
||||||
}
|
}
|
||||||
`, root, "AudioService.NormalNotificationSound")
|
`, root, "AudioService.NormalNotificationSound")
|
||||||
|
|
||||||
|
const messageNewInstantPath = getSoundPath("message-new-instant")
|
||||||
criticalNotificationSound = Qt.createQmlObject(`
|
criticalNotificationSound = Qt.createQmlObject(`
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
source: Qt.resolvedUrl("../assets/sounds/freedesktop/message-new-instant.wav")
|
source: "${messageNewInstantPath}"
|
||||||
audioOutput: AudioOutput { volume: 1.0 }
|
audioOutput: AudioOutput { volume: 1.0 }
|
||||||
}
|
}
|
||||||
`, root, "AudioService.CriticalNotificationSound")
|
`, root, "AudioService.CriticalNotificationSound")
|
||||||
@@ -345,12 +562,20 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: SettingsData
|
||||||
|
function onUseSystemSoundThemeChanged() {
|
||||||
|
reloadSounds()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!detectSoundsAvailability()) {
|
if (!detectSoundsAvailability()) {
|
||||||
console.warn("AudioService: QtMultimedia not available - sound effects disabled")
|
console.warn("AudioService: QtMultimedia not available - sound effects disabled")
|
||||||
} else {
|
} else {
|
||||||
console.log("AudioService: Sound effects enabled")
|
console.log("AudioService: Sound effects enabled")
|
||||||
createSoundPlayers()
|
checkGsettings()
|
||||||
|
Qt.callLater(createSoundPlayers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user