GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat: ensure that only a single exists of the wm
Lars Berger2993cfd6881b
diff --git a/packages/wm/src/common/platform/platform.rs b/packages/wm/src/common/platform/platform.rsindex d586035b..ca2f2d81 100644--- a/packages/wm/src/common/platform/platform.rs+++ b/packages/wm/src/common/platform/platform.rs@@ -3,11 +3,11 @@ use std::sync::Arc;use tokio::sync::Mutex;use windows::Win32::UI::WindowsAndMessaging::GetForegroundWindow;-use crate::user_config::{ParsedConfig, UserConfig};+use crate::user_config::UserConfig;use super::{native_monitor, native_window, EventListener, NativeMonitor,- NativeWindow,+ NativeWindow, SingleInstance,};pub struct Platform;@@ -42,4 +42,8 @@ impl Platform {) -> anyhow::Result<EventListener> {EventListener::start(config).await}++ pub fn new_single_instance() -> anyhow::Result<SingleInstance> {+ SingleInstance::new()+ }}diff --git a/packages/wm/src/main.rs b/packages/wm/src/main.rsindex ceea0f7f..6101f11a 100644--- a/packages/wm/src/main.rs+++ b/packages/wm/src/main.rs@@ -48,6 +48,9 @@ async fn main() {}async fn start_wm(config_path: Option<String>) -> Result<()> {+ // Ensure that only one instance of the WM is running.+ let _ = Platform::new_single_instance()?;+// Parse and validate user config.let config = UserConfig::read(config_path).await?;