From 381253da208b80f2995207004a0e7ff00be371bd Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 20 Aug 2021 17:16:14 -0700 Subject: [PATCH] fix(wm): switch to correct ws when following links Silly boolean error meant that if a link was clicked in one monitor/workspace, the browser, if not on the same workspace, would be brought into the workspace the link was clicked in. This was because I was checking if the focused monitor != the known monitor && the focused workspace != the known workspace, when in fact, we don't need both of those conditions to be true in order to switch to where the browser is, we only need one of them to be true. After changing the && (and) to a || (or), the behaviour is now as expected, and clicking a link will switch to the workspace where the browser is open. --- Cargo.lock | 10 +++++----- komorebi-core/Cargo.toml | 2 +- komorebi/Cargo.toml | 2 +- komorebi/src/process_event.rs | 12 ++++++------ komorebic/Cargo.toml | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6990d2e..d2cf9a8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -496,7 +496,7 @@ dependencies = [ [[package]] name = "komorebi" -version = "0.1.1" +version = "0.1.2" dependencies = [ "bindings", "bitflags", @@ -527,7 +527,7 @@ dependencies = [ [[package]] name = "komorebi-core" -version = "0.1.1" +version = "0.1.2" dependencies = [ "bindings", "clap", @@ -539,7 +539,7 @@ dependencies = [ [[package]] name = "komorebic" -version = "0.1.1" +version = "0.1.2" dependencies = [ "bindings", "clap", @@ -1155,9 +1155,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.74" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" dependencies = [ "proc-macro2", "quote", diff --git a/komorebi-core/Cargo.toml b/komorebi-core/Cargo.toml index 4e625aa4..12172084 100644 --- a/komorebi-core/Cargo.toml +++ b/komorebi-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebi-core" -version = "0.1.1" +version = "0.1.2" edition = "2018" # 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 9ba6e575..3f674fbe 100644 --- a/komorebi/Cargo.toml +++ b/komorebi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebi" -version = "0.1.1" +version = "0.1.2" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index aaa506c2..afd992ca 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -154,16 +154,16 @@ impl WindowManager { } } - if let Some(indices) = switch_to { - if self.focused_monitor_idx() != indices.0 - && self + if let Some((known_monitor_idx, known_workspace_idx)) = switch_to { + if self.focused_monitor_idx() != known_monitor_idx + || self .focused_monitor() .context("there is no monitor")? .focused_workspace_idx() - != indices.1 + != known_workspace_idx { - self.focus_monitor(indices.0)?; - self.focus_workspace(indices.1)?; + self.focus_monitor(known_monitor_idx)?; + self.focus_workspace(known_workspace_idx)?; return Ok(()); } } diff --git a/komorebic/Cargo.toml b/komorebic/Cargo.toml index 143f6323..bb9eb86d 100644 --- a/komorebic/Cargo.toml +++ b/komorebic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebic" -version = "0.1.1" +version = "0.1.2" authors = ["Jade Iqbal "] description = "The command-line interface for Komorebi, a tiling window manager for Windows" categories = ["cli", "tiling-window-manager", "windows"]