Skip to content

Commit

Permalink
fix(wm): ensure borders are drawn w/ stackbar
Browse files Browse the repository at this point in the history
This commit fixes a small regression and ensures that the active window
border, when enabled, will be drawn as expected when a container stack
has a stackbar active.
  • Loading branch information
LGUG2Z committed Apr 13, 2024
1 parent b61146e commit d8d087e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 11 additions & 1 deletion komorebi/src/process_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,20 @@ impl WindowManager {
if BORDER_ENABLED.load(Ordering::SeqCst) {
if let WindowManagerEvent::FocusChange(_, window) = event {
let border_window = Border::from(BORDER_HWND.load(Ordering::SeqCst));

if should_manage {
border_window.set_position(*window, true)?;
} else {
border_window.hide()?;
let mut stackbar = false;
if let Ok(class) = window.class() {
if class == "komorebi_stackbar" {
stackbar = true;
}
}

if !stackbar {
border_window.hide()?;
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion komorebi/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,12 @@ impl Window {
// If not allowing cloaked windows, we need to ensure the window is not cloaked
(false, false) => {
if let (Ok(title), Ok(exe_name), Ok(class), Ok(path)) = (self.title(), self.exe(), self.class(), self.path()) {
return Ok(window_is_eligible(&title, &exe_name, &class, &path, &self.style()?, &self.ex_style()?, event));
// calls for styles can fail quite often for events with windows that aren't really "windows"
// since we have moved up calls of should_manage to the beginning of the process_event handler,
// we should handle failures here gracefully to be able to continue the execution of process_event
if let (Ok(style), Ok(ex_style)) = (&self.style(), &self.ex_style()) {
return Ok(window_is_eligible(&title, &exe_name, &class, &path, style, ex_style, event));
}
}
}
_ => {}
Expand Down

0 comments on commit d8d087e

Please sign in to comment.