GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat: watcher (WIP)
holbyf119bfae8ea2
diff --git a/packages/watcher/src/main.rs b/packages/watcher/src/main.rsindex 46f3d1e1..5a5f5400 100644--- a/packages/watcher/src/main.rs+++ b/packages/watcher/src/main.rs@@ -1,7 +1,23 @@+use wm::ipc_client::IpcClient;use wm::user_config::UserConfig;#[tokio::main]async fn main() {let config = UserConfig::new(None).await.unwrap();+ match IpcClient::connect().await {+ Ok(mut client) => {+ loop {+ client.send("Watcher process | PING").await.unwrap();+ tokio::time::sleep(std::time::Duration::from_secs(1)).await;+ }+ },+ Err(e) => {+ eprintln!("Failed to connect to IPC server: {:?}", e);+ loop {+ tokio::time::sleep(std::time::Duration::from_secs(1)).await;+ }+ }+ }+println!("config: {:?}", config);}diff --git a/packages/wm/src/main.rs b/packages/wm/src/main.rsindex 2acc84a6..272e7fc8 100644--- a/packages/wm/src/main.rs+++ b/packages/wm/src/main.rs@@ -5,10 +5,11 @@#![feature(iterator_try_collect)]#![feature(once_cell_try)]-use std::{env, path::PathBuf};+use std::{process::Child, env, io, path::PathBuf};-use anyhow::{Context, Result};-use tokio::{process::Command, signal};++use anyhow::{Context, Error, Result};+use tokio::{process, process::Command, signal};use tracing::{debug, error, info};use crate::{@@ -209,11 +210,11 @@ async fn start_cli(args: Vec<String>) -> Result<()> {////// This assumes the watcher binary exists in the same directory as the WM/// binary.-fn start_watcher_process() -> Result<Command> {- let watcher_path = env::current_exe()?- .parent()- .context("Failed to resolve path to the watcher process.")?- .join("watcher");- Ok(Command::new(watcher_path))+fn start_watcher_process() -> anyhow::Result<tokio::process::Child, Error> {+ let watcher_path = env::current_exe()?+ .parent()+ .context("Failed to resolve path to the watcher process.")?+ .join("watcher");+ Command::new(&watcher_path).spawn().context("Failed to start watcher process")}