feat: is_running for linux
parent
86782a4f9a
commit
cdca6f026c
|
@ -20,3 +20,7 @@ pub fn run(callback: fn(Event)) -> Result<(), Error> {
|
|||
pub fn stop() -> Result<(), Error> {
|
||||
platforms::stop()
|
||||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
platforms::is_running()
|
||||
}
|
||||
|
|
|
@ -158,3 +158,7 @@ pub fn stop() -> Result<(), Error> {
|
|||
message: "Hook cannot be stopped before starting.".into(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
unsafe { STARTED }
|
||||
}
|
||||
|
|
|
@ -53,3 +53,11 @@ pub fn stop() -> Result<(), Error> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
match unsafe { &SELECTED_METHOD } {
|
||||
LinuxHookMethod::InputDev => inputdev::is_running(),
|
||||
LinuxHookMethod::XInput => xinput::is_running(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,16 @@ pub fn stop() -> Result<(), Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
unsafe {
|
||||
if let Some(_) = &RECORDER {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn record_callback(_: *mut i8, raw_data: *mut xrecord::XRecordInterceptData) {
|
||||
let data = &*raw_data;
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@ pub fn stop() -> Result<(), Error> {
|
|||
linux::stop()
|
||||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
linux::is_running()
|
||||
}
|
||||
|
||||
// ------- WINDOWS -------
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
|
|
Reference in New Issue