diff --git a/src/electron/windowManager.js b/src/electron/windowManager.js index 04337c5..145440f 100644 --- a/src/electron/windowManager.js +++ b/src/electron/windowManager.js @@ -946,56 +946,56 @@ function setupIpcHandlers(movementManager) { } }); - // ipcMain.handle('get-header-position', () => { - // const header = windowPool.get('header'); - // if (header) { - // const [x, y] = header.getPosition(); - // return { x, y }; - // } - // return { x: 0, y: 0 }; - // }); + ipcMain.handle('get-header-position', () => { + const header = windowPool.get('header'); + if (header) { + const [x, y] = header.getPosition(); + return { x, y }; + } + return { x: 0, y: 0 }; + }); - // ipcMain.handle('move-header', (event, newX, newY) => { - // const header = windowPool.get('header'); - // if (header) { - // const currentY = newY !== undefined ? newY : header.getBounds().y; - // header.setPosition(newX, currentY, false); + ipcMain.handle('move-header', (event, newX, newY) => { + const header = windowPool.get('header'); + if (header) { + const currentY = newY !== undefined ? newY : header.getBounds().y; + header.setPosition(newX, currentY, false); - // updateLayout(); - // } - // }); + updateLayout(); + } + }); - // ipcMain.handle('move-header-to', (event, newX, newY) => { - // const header = windowPool.get('header'); - // if (header) { - // const targetDisplay = screen.getDisplayNearestPoint({ x: newX, y: newY }); - // const { x: workAreaX, y: workAreaY, width, height } = targetDisplay.workArea; - // const headerBounds = header.getBounds(); + ipcMain.handle('move-header-to', (event, newX, newY) => { + const header = windowPool.get('header'); + if (header) { + const targetDisplay = screen.getDisplayNearestPoint({ x: newX, y: newY }); + const { x: workAreaX, y: workAreaY, width, height } = targetDisplay.workArea; + const headerBounds = header.getBounds(); - // // Only clamp if the new position would actually go out of bounds - // // This prevents progressive restriction of movement - // let clampedX = newX; - // let clampedY = newY; + // Only clamp if the new position would actually go out of bounds + // This prevents progressive restriction of movement + let clampedX = newX; + let clampedY = newY; - // // Check if we need to clamp X position - // if (newX < workAreaX) { - // clampedX = workAreaX; - // } else if (newX + headerBounds.width > workAreaX + width) { - // clampedX = workAreaX + width - headerBounds.width; - // } + // Check if we need to clamp X position + if (newX < workAreaX) { + clampedX = workAreaX; + } else if (newX + headerBounds.width > workAreaX + width) { + clampedX = workAreaX + width - headerBounds.width; + } - // // Check if we need to clamp Y position - // if (newY < workAreaY) { - // clampedY = workAreaY; - // } else if (newY + headerBounds.height > workAreaY + height) { - // clampedY = workAreaY + height - headerBounds.height; - // } + // Check if we need to clamp Y position + if (newY < workAreaY) { + clampedY = workAreaY; + } else if (newY + headerBounds.height > workAreaY + height) { + clampedY = workAreaY + height - headerBounds.height; + } - // header.setPosition(clampedX, clampedY, false); + header.setPosition(clampedX, clampedY, false); - // updateLayout(); - // } - // }); + updateLayout(); + } + }); ipcMain.handle('move-window-step', (event, direction) => {