mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-24 01:28:39 +02:00
fix(wm): move last_focused_workspace logic to focus_workspace method
There are currently a number of commands that do not update the previously focused workspace correctly. The previous method relied on handling each case, this change makes it so that last_focused_workspace is always updated whenever the focus is changed.
This commit is contained in:
@@ -500,7 +500,7 @@ impl Monitor {
|
|||||||
if workspaces.get(idx).is_none() {
|
if workspaces.get(idx).is_none() {
|
||||||
workspaces.resize(idx + 1, Workspace::default());
|
workspaces.resize(idx + 1, Workspace::default());
|
||||||
}
|
}
|
||||||
|
self.set_last_focused_workspace(Some(self.workspaces.focused_idx()));
|
||||||
self.workspaces.focus(idx);
|
self.workspaces.focus(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,25 +209,6 @@ impl WindowManager {
|
|||||||
// We don't have From implemented for &mut WindowManager
|
// We don't have From implemented for &mut WindowManager
|
||||||
let initial_state = State::from(self.as_ref());
|
let initial_state = State::from(self.as_ref());
|
||||||
|
|
||||||
match message {
|
|
||||||
SocketMessage::CycleFocusEmptyWorkspace(_)
|
|
||||||
| SocketMessage::CycleFocusWorkspace(_)
|
|
||||||
| SocketMessage::FocusWorkspaceNumber(_) => {
|
|
||||||
if let Some(monitor) = self.focused_monitor_mut() {
|
|
||||||
let idx = monitor.focused_workspace_idx();
|
|
||||||
monitor.set_last_focused_workspace(Option::from(idx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SocketMessage::FocusMonitorWorkspaceNumber(target_monitor_idx, _) => {
|
|
||||||
let idx = self.focused_workspace_idx_for_monitor_idx(target_monitor_idx)?;
|
|
||||||
if let Some(monitor) = self.monitors_mut().get_mut(target_monitor_idx) {
|
|
||||||
monitor.set_last_focused_workspace(Option::from(idx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ => {}
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut force_update_borders = false;
|
let mut force_update_borders = false;
|
||||||
match message {
|
match message {
|
||||||
SocketMessage::Promote => self.promote_container_to_front()?,
|
SocketMessage::Promote => self.promote_container_to_front()?,
|
||||||
|
|||||||
Reference in New Issue
Block a user