forked from Shinonome/dots-hyprland
✨ feat: sound alerts for battery and pomodoro
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user