Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat: add watcher process

Lars Bergercfc1b4862b61
diff --git a/packages/ipc-client/src/lib.rs b/packages/ipc-client/src/lib.rs
index f167d6de..20f2a2ab 100644
--- a/packages/ipc-client/src/lib.rs
+++ b/packages/ipc-client/src/lib.rs
@@ -7,10 +7,6 @@ pub const DEFAULT_IPC_ADDR: &'static str = "127.0.0.1:6123";
pub struct IpcClient {}
impl IpcClient {
- pub fn new() -> Self {
- Self {}
- }
-
pub async fn connect() -> Result<()> {
todo!()
}
diff --git a/packages/watcher/Cargo.toml b/packages/watcher/Cargo.toml
index 073878cf..a0b44ca5 100644
--- a/packages/watcher/Cargo.toml
+++ b/packages/watcher/Cargo.toml
@@ -5,3 +5,6 @@ edition = "2021"
[dependencies]
ipc-client = { path = "../ipc-client" }
+
+anyhow = { workspace = true }
+tokio = { workspace = true }
diff --git a/packages/watcher/src/lib.rs b/packages/watcher/src/lib.rs
deleted file mode 100644
index 6e95421b..00000000
--- a/packages/watcher/src/lib.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-pub fn add(a: i32, b: i32) -> i32 {
- a + b
-}
diff --git a/packages/watcher/src/main.rs b/packages/watcher/src/main.rs
new file mode 100644
index 00000000..3ca1bf28
--- /dev/null
+++ b/packages/watcher/src/main.rs
@@ -0,0 +1,4 @@
+#[tokio::main]
+async fn main() {
+ println!("fdjsaiofa");
+}
diff --git a/packages/wm/Cargo.toml b/packages/wm/Cargo.toml
index 5c7317be..4d7a968c 100644
--- a/packages/wm/Cargo.toml
+++ b/packages/wm/Cargo.toml
@@ -8,8 +8,7 @@ edition = "2021"
[dependencies]
ipc-client = { path = "../ipc-client" }
-ipc-server = { path = "../ipc-server" }
-watcher = { path = "../watcher" }
+watcher = { path = "../watcher", artifact = "bin" }
anyhow = { workspace = true }
clap = { version = "4", features = ["derive"] }
diff --git a/packages/wm/src/main.rs b/packages/wm/src/main.rs
index 79359769..8ffd2719 100644
--- a/packages/wm/src/main.rs
+++ b/packages/wm/src/main.rs
@@ -38,9 +38,15 @@ async fn main() {
}
async fn start_wm(config_path: Option<&str>) {
+ // Parse and validate user config.
let user_config = UserConfig::read(config_path).await;
+
let event_listener = platform::EventListener::new().start().await;
let ipc_server = IpcServer::new().start().await;
+
+ // Start watcher process for restoring hidden windows on crash.
+ start_watcher_process()?;
+
let wm = WindowManager::new(user_config).start().await;
loop {
@@ -60,3 +66,9 @@ async fn start_wm(config_path: Option<&str>) {
}
}
}
+
+fn start_watcher_process() -> Result<()> {
+ let watcher_path = env::var_os("CARGO_BIN_FILE_WATCHER").expect("watcher binary");
+ let mut watcher = Command::new(watcher_path);
+ watcher.status().expect("watcher failed").success();
+}