Skip to content

Commit

Permalink
fix(wm): update monitor focus before focus-stack-window
Browse files Browse the repository at this point in the history
This commit fixes the cases where you'd call this command on a monitor
which was not focused, for example by pressing a button on a bar like
komorebi-bar or other when you had focus on another monitor.
This change ensures that first we focus the monitor where the mouse cursor
is, this way it will act on the monitor that you've just pressed instead
of the monior that was focused before.
  • Loading branch information
alex-ds13 authored and LGUG2Z committed Oct 13, 2024
1 parent 96605f7 commit a5e6828
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions komorebi/src/process_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ impl WindowManager {
self.focused_window()?.focus(self.mouse_follows_focus)?;
}
SocketMessage::FocusStackWindow(idx) => {
// In case you are using this command on a bar on a monitor
// different from the currently focused one, you'd want that
// monitor to be focused so that the FocusStackWindow happens
// on the monitor with the bar you just pressed.
if let Some(monitor_idx) = self.monitor_idx_from_current_pos() {
self.focus_monitor(monitor_idx)?;
}
self.focus_container_window(idx)?;
self.focused_window()?.focus(self.mouse_follows_focus)?;
}
Expand Down

0 comments on commit a5e6828

Please sign in to comment.