From 52b7b8d03d53161a2535a4faabae87508bb1cf08 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Thu, 11 Aug 2022 20:02:39 -0700 Subject: [PATCH] fix(wm): ensure await-configuration is opt-in --- Cargo.lock | 6 +++--- README.md | 7 ++++--- komorebi-core/Cargo.toml | 2 +- komorebi/Cargo.toml | 2 +- komorebi/src/main.rs | 13 +++++++++---- komorebic/Cargo.toml | 2 +- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 264dc20a..bd28de23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -464,7 +464,7 @@ dependencies = [ [[package]] name = "komorebi" -version = "0.1.11" +version = "0.1.12" dependencies = [ "bitflags", "clap", @@ -499,7 +499,7 @@ dependencies = [ [[package]] name = "komorebi-core" -version = "0.1.11" +version = "0.1.12" dependencies = [ "clap", "color-eyre", @@ -513,7 +513,7 @@ dependencies = [ [[package]] name = "komorebic" -version = "0.1.11" +version = "0.1.12" dependencies = [ "clap", "color-eyre", diff --git a/README.md b/README.md index df98ed2c..d7053ebf 100644 --- a/README.md +++ b/README.md @@ -286,9 +286,10 @@ with many retile events. If you would like to avoid this, you can start `komorebi` with a flag which tells `komorebi` to wait until all configuration has been loaded before listening to and responding to window manager events: `komorebic start --await-configuration`. -If you start `komorebi` with the `--await-configuration` flag, you _must_ send the `komorebic complete-configuration` command -at the end of your `komorebi.ahk` config. The layout will not be updated and `komorebi` will not respond to `komorebic` -commands until this command has been received. +If you start `komorebi` with the `--await-configuration` flag, you _must_ send the `komorebic complete-configuration` +command at the end of the configuration section of your `komorebi.ahk` config (before you start defining the key +bindings). The layout will not be updated and `komorebi` will not respond to `komorebic` commands until this command has +been received. #### Floating Windows diff --git a/komorebi-core/Cargo.toml b/komorebi-core/Cargo.toml index a44cacbb..54ec9d78 100644 --- a/komorebi-core/Cargo.toml +++ b/komorebi-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebi-core" -version = "0.1.11" +version = "0.1.12" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/komorebi/Cargo.toml b/komorebi/Cargo.toml index b4ae4e9e..4078b940 100644 --- a/komorebi/Cargo.toml +++ b/komorebi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebi" -version = "0.1.11" +version = "0.1.12" authors = ["Jade Iqbal "] description = "A tiling window manager for Windows" categories = ["tiling-window-manager", "windows"] diff --git a/komorebi/src/main.rs b/komorebi/src/main.rs index a4fb4a6e..105b415b 100644 --- a/komorebi/src/main.rs +++ b/komorebi/src/main.rs @@ -256,9 +256,7 @@ pub fn load_configuration() -> Result<()> { Command::new("AutoHotkey64.exe") .arg(config_v2.as_os_str()) .output()?; - } else { - INITIAL_CONFIGURATION_LOADED.store(true, Ordering::SeqCst); - }; + } Ok(()) } @@ -443,7 +441,14 @@ fn main() -> Result<()> { wm.lock().init()?; listen_for_commands(wm.clone()); - std::thread::spawn(|| load_configuration().expect("could not load configuration")); + + if !opts.await_configuration && !INITIAL_CONFIGURATION_LOADED.load(Ordering::SeqCst) { + INITIAL_CONFIGURATION_LOADED.store(true, Ordering::SeqCst); + }; + + std::thread::spawn(|| { + load_configuration().expect("could not load configuration"); + }); if opts.await_configuration { let backoff = Backoff::new(); diff --git a/komorebic/Cargo.toml b/komorebic/Cargo.toml index 53ef898f..62ded174 100644 --- a/komorebic/Cargo.toml +++ b/komorebic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebic" -version = "0.1.11" +version = "0.1.12" authors = ["Jade Iqbal "] description = "The command-line interface for Komorebi, a tiling window manager for Windows" categories = ["cli", "tiling-window-manager", "windows"]