mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
feat(electron): should listen to app audio input event for isRunning check (#11315)
fix AF-2435
This commit is contained in:
@@ -16,8 +16,9 @@ use core_foundation::{
|
||||
use coreaudio::sys::{
|
||||
kAudioHardwarePropertyProcessObjectList, kAudioObjectPropertyElementMain,
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectSystemObject, kAudioProcessPropertyBundleID,
|
||||
kAudioProcessPropertyIsRunning, kAudioProcessPropertyPID, AudioObjectAddPropertyListenerBlock,
|
||||
AudioObjectID, AudioObjectPropertyAddress, AudioObjectRemovePropertyListenerBlock,
|
||||
kAudioProcessPropertyIsRunning, kAudioProcessPropertyIsRunningInput, kAudioProcessPropertyPID,
|
||||
AudioObjectAddPropertyListenerBlock, AudioObjectID, AudioObjectPropertyAddress,
|
||||
AudioObjectRemovePropertyListenerBlock,
|
||||
};
|
||||
use libc;
|
||||
use napi::{
|
||||
@@ -422,7 +423,7 @@ impl TappableApplication {
|
||||
pub fn get_is_running(&self) -> Result<bool> {
|
||||
// Use catch_unwind to prevent any panics
|
||||
let result = std::panic::catch_unwind(|| {
|
||||
match get_process_property(&self.object_id, kAudioProcessPropertyIsRunning) {
|
||||
match get_process_property(&self.object_id, kAudioProcessPropertyIsRunningInput) {
|
||||
Ok(is_running) => Ok(is_running),
|
||||
Err(_) => Ok(false),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user