music recognition: add check for songrec command existence

This commit is contained in:
end-4
2025-10-28 08:48:57 +01:00
parent 035e51b36e
commit 06d12fb8ec
2 changed files with 10 additions and 4 deletions
@@ -41,14 +41,15 @@ AndroidQuickToggleButton {
StyledToolTip {
text: Translation.tr("Identifies currently playing song | Right-click to change monitor source")
text: Translation.tr("Recognize music | Right-click to toggle source")
}
onClicked: {
onClicked: {
root.toggled = !root.toggled
recognizeMusicProc.running = root.toggled
musicReconizedProc.running = false
}
altAction: () => {
if (root.monitorSource === "monitor"){
root.monitorSource = "input"
@@ -68,6 +69,12 @@ AndroidQuickToggleButton {
handleRecognition(this.text)
}
}
onExited: (exitCode, exitStatus) => {
if (exitCode === 1) {
Quickshell.execDetached(["notify-send", Translation.tr("Couldn't recognize music"), Translation.tr("Make sure you have songrec installed"), "-a", "Shell"])
root.toggled = false
}
}
}
Process {