Skip to content

Commit

Permalink
fix(wm): handle regression switching from empty ws
Browse files Browse the repository at this point in the history
  • Loading branch information
LGUG2Z committed Feb 15, 2023
1 parent 7bd2ff4 commit a23019e
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions komorebi/src/process_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,6 @@ impl WindowManager {
self.clear_workspace_layout_rules(monitor_idx, workspace_idx)?;
}
SocketMessage::CycleFocusWorkspace(direction) => {
let reenable_border = if BORDER_ENABLED.load(Ordering::SeqCst) {
self.hide_border()?;
true
} else {
false
};

// This is to ensure that even on an empty workspace on a secondary monitor, the
// secondary monitor where the cursor is focused will be used as the target for
// the workspace switch op
Expand All @@ -436,18 +429,11 @@ impl WindowManager {

self.focus_workspace(workspace_idx)?;

if reenable_border {
if BORDER_ENABLED.load(Ordering::SeqCst) {
self.show_border()?;
}
};
}
SocketMessage::FocusWorkspaceNumber(workspace_idx) => {
let reenable_border = if BORDER_ENABLED.load(Ordering::SeqCst) {
self.hide_border()?;
true
} else {
false
};

// This is to ensure that even on an empty workspace on a secondary monitor, the
// secondary monitor where the cursor is focused will be used as the target for
// the workspace switch op
Expand All @@ -457,32 +443,25 @@ impl WindowManager {

self.focus_workspace(workspace_idx)?;

if reenable_border {
if BORDER_ENABLED.load(Ordering::SeqCst) {
self.show_border()?;
}
};
}
SocketMessage::FocusMonitorWorkspaceNumber(monitor_idx, workspace_idx) => {
self.focus_monitor(monitor_idx)?;
self.focus_workspace(workspace_idx)?;
}
SocketMessage::FocusNamedWorkspace(ref name) => {
let reenable_border = if BORDER_ENABLED.load(Ordering::SeqCst) {
self.hide_border()?;
true
} else {
false
};

if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(name)
{
self.focus_monitor(monitor_idx)?;
self.focus_workspace(workspace_idx)?;
}

if reenable_border {
if BORDER_ENABLED.load(Ordering::SeqCst) {
self.show_border()?;
}
};
}
SocketMessage::Stop => {
tracing::info!(
Expand Down

0 comments on commit a23019e

Please sign in to comment.