({ width, height })
| 231 | }; |
| 232 | |
| 233 | const resizeHeaderWindow = ({ width, height }) => { |
| 234 | const header = windowPool.get('header'); |
| 235 | if (header) { |
| 236 | console.log(`[WindowManager] Resize request: ${width}x${height}`); |
| 237 | |
| 238 | if (movementManager && movementManager.isAnimating) { |
| 239 | console.log('[WindowManager] Skipping resize during animation'); |
| 240 | return { success: false, error: 'Cannot resize during animation' }; |
| 241 | } |
| 242 | |
| 243 | const currentBounds = header.getBounds(); |
| 244 | console.log(`[WindowManager] Current bounds: ${currentBounds.width}x${currentBounds.height} at (${currentBounds.x}, ${currentBounds.y})`); |
| 245 | |
| 246 | if (currentBounds.width === width && currentBounds.height === height) { |
| 247 | console.log('[WindowManager] Already at target size, skipping resize'); |
| 248 | return { success: true }; |
| 249 | } |
| 250 | |
| 251 | const wasResizable = header.isResizable(); |
| 252 | if (!wasResizable) { |
| 253 | header.setResizable(true); |
| 254 | } |
| 255 | |
| 256 | const centerX = currentBounds.x + currentBounds.width / 2; |
| 257 | const newX = Math.round(centerX - width / 2); |
| 258 | |
| 259 | const display = getCurrentDisplay(header); |
| 260 | const { x: workAreaX, width: workAreaWidth } = display.workArea; |
| 261 | |
| 262 | const clampedX = Math.max(workAreaX, Math.min(workAreaX + workAreaWidth - width, newX)); |
| 263 | |
| 264 | header.setBounds({ x: clampedX, y: currentBounds.y, width, height }); |
| 265 | |
| 266 | if (!wasResizable) { |
| 267 | header.setResizable(false); |
| 268 | } |
| 269 | |
| 270 | if (updateLayout) { |
| 271 | updateLayout(); |
| 272 | } |
| 273 | |
| 274 | return { success: true }; |
| 275 | } |
| 276 | return { success: false, error: 'Header window not found' }; |
| 277 | }; |
| 278 | |
| 279 | const openShortcutEditor = () => { |
| 280 | const header = windowPool.get('header'); |
nothing calls this directly
no test coverage detected