히스토리 팝업 수정: ESC 닫기 + Arrow 키 네비게이션

- Arrow↑↓/Enter/Escape/1-9 키를 팝업 열릴 때 globalShortcut 등록, 닫힐 때 해제
- showHistoryPopup: 2-phase 제거 → 즉시 show (렌더러 비활성 문제 방지)
- hideHistoryPopup/itemSelected/popupDismissed에서 nav 키 해제
This commit is contained in:
Yun Chan 2026-04-05 12:38:54 +09:00
parent 2392d05ded
commit 6e9e8b1f29
2 changed files with 59 additions and 21 deletions

View file

@ -308,32 +308,30 @@ export function getHistoryPopupWindow(): BrowserWindow {
export function showHistoryPopup(entries: Array<Record<string, unknown>>): void {
const win = getHistoryPopupWindow()
win.webContents.send('history:showItems', { entries })
// 커서 위치에 즉시 배치+표시 (2-phase 제거 — 숨겨진 윈도우 렌더러 비활성 문제 방지)
const cursorPos = screen.getCursorScreenPoint()
const display = screen.getDisplayNearestPoint(cursorPos)
const handler = (_event: Electron.IpcMainEvent, data: { width: number; height: number }) => {
ipcMain.removeListener('history:popupMeasured', handler)
const popupWidth = 380
const popupHeight = Math.min(60 + entries.length * 44, 500)
const cursorPos = screen.getCursorScreenPoint()
const display = screen.getDisplayNearestPoint(cursorPos)
let x = cursorPos.x - Math.round(popupWidth / 2)
let y = cursorPos.y - popupHeight - 20
let x = cursorPos.x - Math.round(data.width / 2)
let y = cursorPos.y - data.height - 20
x = Math.max(display.workArea.x, Math.min(x, display.workArea.x + display.workArea.width - data.width))
if (y < display.workArea.y) {
y = cursorPos.y + 20
}
win.setBounds({ x, y, width: data.width, height: data.height })
if (!win.isVisible()) {
win.showInactive()
}
win.webContents.send('history:show', {})
x = Math.max(display.workArea.x, Math.min(x, display.workArea.x + display.workArea.width - popupWidth))
if (y < display.workArea.y) {
y = cursorPos.y + 20
}
ipcMain.on('history:popupMeasured', handler)
win.setBounds({ x, y, width: popupWidth, height: popupHeight })
win.webContents.send('history:showItems', { entries })
if (!win.isVisible()) {
win.showInactive()
}
win.webContents.send('history:show', {})
}
export function hideHistoryPopup(): void {