feat: sound alerts for battery and pomodoro

This commit is contained in:
0blivi0nis
2025-10-16 19:03:14 -07:00
parent 89585f8121
commit 37fd19fc9a
5 changed files with 112 additions and 7 deletions
+23 -1
View File
@@ -15,6 +15,7 @@ Singleton {
property PwNode sink: Pipewire.defaultAudioSink
property PwNode source: Pipewire.defaultAudioSource
readonly property real hardMaxValue: 2.00 // People keep joking about setting volume to 5172% so...
property string audioTheme: Config.options.sounds.theme
signal sinkProtectionTriggered(string reason);
@@ -49,7 +50,28 @@ Singleton {
}
lastVolume = sink.audio.volume;
}
}
function playSystemSound(soundName) {
const ogaPath = `/usr/share/sounds/${root.audioTheme}/stereo/${soundName}.oga`;
const oggPath = `/usr/share/sounds/${root.audioTheme}/stereo/${soundName}.ogg`;
// Try playing .oga first
let command = [
"ffplay",
"-nodisp",
"-autoexit",
ogaPath
];
Quickshell.execDetached(command);
// Also try playing .ogg (ffplay will just fail silently if file doesn't exist)
command = [
"ffplay",
"-nodisp",
"-autoexit",
oggPath
];
Quickshell.execDetached(command);
}
}