{"record":{"id":"b693602cd7aee2f4","repo":"LGUG2Z/komorebi","slug":"cannot-move-native-maximized-window-to-another-mon","errorCode":null,"errorMessage":"cannot move native maximized window to another monitor or workspace","messagePattern":"cannot move native maximized window to another monitor or workspace","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebi/src/monitor.rs","lineNumber":395,"sourceCode":"    }\n\n    pub fn remove_workspaces(&mut self) -> VecDeque<Workspace> {\n        std::mem::take(self.workspaces_mut())\n    }\n\n    #[tracing::instrument(skip(self))]\n    pub fn move_container_to_workspace(\n        &mut self,\n        target_workspace_idx: usize,\n        follow: bool,\n        direction: Option<OperationDirection>,\n    ) -> eyre::Result<()> {\n        let workspace = self\n            .focused_workspace_mut()\n            .ok_or_eyre(\"there is no workspace\")?;\n\n        if workspace.maximized_window.is_some() {\n            bail!(\"cannot move native maximized window to another monitor or workspace\");\n        }\n\n        let foreground_hwnd = WindowsApi::foreground_window()?;\n        let floating_window_index = workspace\n            .floating_windows()\n            .iter()\n            .position(|w| w.hwnd == foreground_hwnd);\n\n        if let Some(idx) = floating_window_index {\n            if let Some(window) = workspace.floating_windows_mut().remove(idx) {\n                let workspaces = self.workspaces_mut();\n                #[allow(clippy::option_if_let_else)]\n                let target_workspace = match workspaces.get_mut(target_workspace_idx) {\n                    None => {\n                        workspaces.resize(target_workspace_idx + 1, Workspace::default());\n                        workspaces.get_mut(target_workspace_idx).unwrap()\n                    }\n                    Some(workspace) => workspace,","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi/src/monitor.rs#L377-L413","documentation":"Monitor::move_container_to_workspace refuses to move a container when the target workspace has a native (Windows) maximized window, because moving a window into a monitor/workspace with a natively maximized window would break the maximized state invariant. It bails with this error.","triggerScenarios":"Calling move_container_to_workspace (or komorebic commands like move-to-workspace / cycle-move) when the destination workspace's maximized_window is Some, i.e. a window is natively maximized there (MaximizedLayout / native maximize).","commonSituations":"User presses move-to-workspace keybind while a video/game/terminal is natively maximized on the destination workspace; scripts iterating workspaces that hit a maximized window.","solutions":["Restore/unmaximize the window on the destination workspace before moving, then re-run the move.","Switch the destination workspace to use komorebi's managed maximize (komorebic promote / resize) instead of native maximize.","Check first via query whether the target workspace has a maximized window and skip/queue the move in scripts."],"exampleFix":"// before\nkomorebic move-to-workspace 3   # fails: native maximized window on ws 3\n// after\nkomorebic cycle-move-monitor  # or first: focus ws 3 and restore the maximized window\nkomorebic move-to-workspace 3","handlingStrategy":"validation","validationCode":"// PowerShell pre-check before move-to-workspace keybind/script\n# skip the move if the target workspace has a native maximized window\nkomorebic state | Select-String 'Maximized'","typeGuard":"fn can_move_to(workspace: &Workspace) -> bool {\n    workspace.maximized_window.is_none()\n}","tryCatchPattern":"if let Err(e) = monitor.move_container_to_workspace(idx) {\n    tracing::warn!(\"move skipped: {e}; unmaximize the target workspace window first\");\n}","preventionTips":["Unmaximize native-maximized windows before moving others into that workspace","Prefer komorebi-managed maximize over native maximize in workflows","Guard scripted batch moves with a maximized-window check"],"tags":["workspace","maximized-window","window-management"],"backgroundTag":"invalid-state-transition","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}