Skip to content

Commit

Permalink
fix(wm): populate ws rules on config reload
Browse files Browse the repository at this point in the history
This commit fixes a bug where workspace rules would not be populated
properly on file reloads, leading to issues with the
ReplaceConfiguration message handler.
  • Loading branch information
LGUG2Z committed Jan 26, 2025
1 parent f73f0a0 commit fcd1c9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions komorebi/src/process_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,8 @@ impl WindowManager {
// Initialize the new wm
wm.init()?;

wm.restore_all_windows(true)?;

// This is equivalent to StaticConfig::postload for this use case
StaticConfig::reload(config, &mut wm)?;

Expand Down
5 changes: 3 additions & 2 deletions komorebi/src/static_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,9 @@ impl StaticConfig {
value.apply_globals()?;

if let Some(monitors) = value.monitors {
let mut workspace_matching_rules = WORKSPACE_MATCHING_RULES.lock();
workspace_matching_rules.clear();

for (i, monitor) in monitors.iter().enumerate() {
if let Some(m) = wm.monitors_mut().get_mut(i) {
m.ensure_workspace_count(monitor.workspaces.len());
Expand All @@ -1238,8 +1241,6 @@ impl StaticConfig {
}
}

let mut workspace_matching_rules = WORKSPACE_MATCHING_RULES.lock();
workspace_matching_rules.clear();
for (j, ws) in monitor.workspaces.iter().enumerate() {
if let Some(rules) = &ws.workspace_rules {
for r in rules {
Expand Down

0 comments on commit fcd1c9d

Please sign in to comment.