mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-10 07:11:29 +03:00
macos: enable running lan-mouse on macos (#42)
* macos: initial support - adapted conditional compilation - moved lan-mouse socket to ~/Library/Caches/lan-mouse-socket.sock instead of XDG_RUNTIME_DIR - support for mouse input emulation TODO: Keycode translation, input capture
This commit is contained in:
committed by
GitHub
parent
5a7e0cf89c
commit
e3f9947284
@@ -126,7 +126,7 @@ pub struct FrontendListener {
|
||||
}
|
||||
|
||||
impl FrontendListener {
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
pub fn socket_path() -> Result<PathBuf> {
|
||||
let xdg_runtime_dir = match env::var("XDG_RUNTIME_DIR") {
|
||||
Ok(d) => d,
|
||||
@@ -136,6 +136,20 @@ impl FrontendListener {
|
||||
Ok(xdg_runtime_dir.join("lan-mouse-socket.sock"))
|
||||
}
|
||||
|
||||
#[cfg(all(unix, target_os = "macos"))]
|
||||
pub fn socket_path() -> Result<PathBuf> {
|
||||
let home = match env::var("HOME") {
|
||||
Ok(d) => d,
|
||||
Err(e) => return Err(anyhow!("could not find HOME: {e}")),
|
||||
};
|
||||
let home = Path::new(home.as_str());
|
||||
let path = home
|
||||
.join("Library")
|
||||
.join("Caches")
|
||||
.join("lan-mouse-socket.sock");
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
pub async fn new() -> Option<Result<Self>> {
|
||||
#[cfg(unix)]
|
||||
let (socket_path, listener) = {
|
||||
|
||||
Reference in New Issue
Block a user