Skip to content

Commit

Permalink
fix(wm): ensure window restore on stackbar click
Browse files Browse the repository at this point in the history
This commit ensures that a window is restored before a focus call is
made on it when switching windows in a stack by using a window's tab in
the stackbar.

This handles the issue where two clicks are required to trigger a layout
update the first time a window that is not currently at the top of the
stack is brought to the front via a stackbar click.
  • Loading branch information
LGUG2Z committed Apr 14, 2024
1 parent efa562d commit 4ba3125
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions komorebi/src/stackbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ use komorebi_core::Rect;

use crate::window::Window;
use crate::windows_api::WindowsApi;
use crate::winevent_listener::event_tx;
use crate::WindowManagerEvent;
use crate::DEFAULT_CONTAINER_PADDING;
use crate::STACKBAR_FOCUSED_TEXT_COLOUR;
use crate::STACKBAR_TAB_BACKGROUND_COLOUR;
Expand Down Expand Up @@ -115,6 +113,7 @@ impl Stackbar {

if x >= left && x <= right && y >= top && y <= bottom {
let window = Window { hwnd: *win_hwnd };
window.restore();
if let Err(err) = window.focus(false) {
tracing::error!("Stackbar focus error: HWND:{} {}", *win_hwnd, err);
}
Expand Down
2 changes: 1 addition & 1 deletion komorebi/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ impl Window {
return Ok(false);
}

let is_cloaked = self.is_cloaked()?;
let is_cloaked = self.is_cloaked().unwrap_or_default();

let mut allow_cloaked = false;

Expand Down

0 comments on commit 4ba3125

Please sign in to comment.