feat(desktop): honest, unified dictation popups with Esc to cancel
Wave 3 of the 2026-09-28 design overhaul. - Esc (no modifiers) cancels an in-progress dictation, recording or processing: VoiceModeService.requestEscape() queues the dead 'escape' action. Clicking the capsule cancels only while recording, so a stray click during processing no longer throws the text away. - Errors show in the user's language: bootstrap now passes error.code to the tip (the translated branch never ran), and one core classifier (voice-error-message) feeds both the tip and the main-window alert. - Capsule: bars stay flat without input (no fake "alive" wobble before the mic opens), an indeterminate bar replaces the made-up percentage, the partial transcript stays visible while processing, an Esc hint, and a brief "Inserted" state so success is visible. - All six popups share popups/_shared (Pretendard, one panel radius, selection, kbd hints, reduced motion). History/command popups get titles, listbox roles and window sizes from popup-list-geometry (empty states were clipped); the command popup's "0" key is registered; result popup explains why it appeared and can be closed; captions keep a theme-independent dark backing on purpose. - Popup themes follow the OS when set to system and the document lang follows the app language. - Site hero demo mirrors the new capsule (done state, indeterminate bar, Esc hint; 10 locales).
This commit is contained in:
parent
f064c93197
commit
7b1210b5d1
41 changed files with 1565 additions and 1143 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
import { getLogger } from '../services/LoggerService'
|
||||
import { getIsQuitting, setIsQuitting } from '../lifecycle'
|
||||
import { hardenWebContents } from './web-contents-hardening'
|
||||
import { commandPopupSize, historyPopupSize } from './popup-list-geometry'
|
||||
import { configGet, configSet } from '../services/ConfigService'
|
||||
import { getI18n } from '@d3ro/i18n'
|
||||
import {
|
||||
|
|
@ -36,6 +37,7 @@ import {
|
|||
sendToPopupWindow
|
||||
} from './popup-window-factory'
|
||||
import { createElectronScreenGeometry } from './screen-geometry'
|
||||
import { installApplicationMenu } from './app-menu'
|
||||
import {
|
||||
SUGGESTION_OVERLAY_MAX_HEIGHT,
|
||||
SUGGESTION_OVERLAY_WIDTH,
|
||||
|
|
@ -48,30 +50,42 @@ const logger = getLogger('WindowManager')
|
|||
/**
|
||||
* 팝업에 주입할 i18n 문자열 맵을 반환.
|
||||
*/
|
||||
function getPopupI18nStrings(): Record<string, string> {
|
||||
/** 현재 설정 언어의 번역 함수 — 팝업(Vanilla JS)에 넘길 문구를 main 에서 만들 때 쓴다 */
|
||||
export function getPopupTranslator(): ReturnType<typeof getI18n>['t'] {
|
||||
const locale = (configGet('language') as string) || 'ko'
|
||||
const { t } = getI18n(locale as 'ko' | 'en' | 'ja' | 'zh' | 'zh-TW' | 'es' | 'fr' | 'de' | 'pt' | 'ru' | 'vi' | 'th')
|
||||
return getI18n(locale as 'ko' | 'en' | 'ja' | 'zh' | 'zh-TW' | 'es' | 'fr' | 'de' | 'pt' | 'ru' | 'vi' | 'th').t
|
||||
}
|
||||
|
||||
function getPopupI18nStrings(): Record<string, string> {
|
||||
const t = getPopupTranslator()
|
||||
return {
|
||||
// command-popup
|
||||
commandSelect: t('popup.commandSelect'),
|
||||
hintsSelect: t('popup.hints.select'),
|
||||
hintsApply: t('popup.hints.apply'),
|
||||
hintsClear: t('popup.hints.clear'),
|
||||
hintsClose: t('popup.hints.close'),
|
||||
noCommands: t('popup.noCommands'),
|
||||
noCommand: t('popup.noCommand'),
|
||||
// history-popup
|
||||
hintsSelectEn: t('popup.hints.selectEn'),
|
||||
hintsPaste: t('popup.hints.paste'),
|
||||
noHistory: t('popup.noHistory'),
|
||||
// history-popup 상대 시간
|
||||
timeJustNow: t('popup.time.justNow'),
|
||||
timeMinutesAgo: t('popup.time.minutesAgo'),
|
||||
timeHoursAgo: t('popup.time.hoursAgo'),
|
||||
timeDaysAgo: t('popup.time.daysAgo'),
|
||||
// result-popup
|
||||
copy: t('popup.copy'),
|
||||
copied: t('popup.copied'),
|
||||
resultTitle: t('popup.result.title'),
|
||||
// 목록 팝업 공통 (v4: 키는 kbd 칩, 설명은 동사)
|
||||
hintMove: t('popup.hints.move'),
|
||||
hintPaste: t('popup.hints.paste2'),
|
||||
hintApply: t('popup.hints.apply2'),
|
||||
hintClose: t('popup.hints.close2'),
|
||||
hintPick: t('popup.hints.pick'),
|
||||
historyTitle: t('popup.history.title'),
|
||||
historyEmpty: t('popup.history.empty'),
|
||||
commandTitle: t('popup.command.title'),
|
||||
commandEmpty: t('popup.command.empty'),
|
||||
commandNone: t('popup.command.none'),
|
||||
// recording-tip
|
||||
errorDefault: t('popup.error.default'),
|
||||
tipProcessing: t('popup.tip.processing'),
|
||||
tipInserted: t('popup.tip.inserted'),
|
||||
tipCancelHint: t('popup.tip.cancelHint'),
|
||||
tipRecording: t('popup.tip.recordingLabel'),
|
||||
close: t('popup.close'),
|
||||
// caption-overlay
|
||||
captionLoading: t('popup.caption.loading'),
|
||||
captionWaiting: t('popup.caption.waiting'),
|
||||
|
|
@ -83,6 +97,8 @@ function getPopupI18nStrings(): Record<string, string> {
|
|||
suggestionWarming: t('popup.suggestion.warming'),
|
||||
suggestionHintGenerating: t('popup.suggestion.hintGenerating'),
|
||||
suggestionLoading: t('popup.suggestion.loading'),
|
||||
// 경과 초가 붙는 "생성 중 {{s}}초" — 빠져 있어 script.js 가 loading 으로 떨어졌다(2026-09-28)
|
||||
suggestionGenerating: t('popup.suggestion.generating'),
|
||||
suggestionSourceModel: t('popup.suggestion.sourceModel'),
|
||||
suggestionSourceMemory: t('popup.suggestion.sourceMemory'),
|
||||
suggestionContinuations: t('popup.suggestion.continuations'),
|
||||
|
|
@ -259,9 +275,10 @@ export function createMainWindow(): BrowserWindow {
|
|||
mainWindowCreated = true
|
||||
mainWindow.setSkipTaskbar(false)
|
||||
|
||||
// Alt 키로 메뉴 활성화 방지: 메뉴 완전 제거
|
||||
// Win/Linux: Alt 키로 메뉴 활성화 방지(메뉴 완전 제거). macOS: 편집 단축키(Cmd+C/V/X/A/Z)와
|
||||
// Cmd+Q 는 애플리케이션 메뉴의 role 항목으로만 동작하므로 최소 메뉴를 유지한다.
|
||||
mainWindow.setMenu(null)
|
||||
Menu.setApplicationMenu(null)
|
||||
installApplicationMenu(Menu, process.platform)
|
||||
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
mainWindow?.show()
|
||||
|
|
@ -368,6 +385,20 @@ export function showRecordingTip(
|
|||
logger.debug(`RecordingTip presented: state=${state} visible=${win.isVisible()} loading=${win.webContents.isLoading()}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 오류를 RecordingTip 에 그리고 팁을 띄운다.
|
||||
* 쿼터 초과·자막 사용 중·STT 모델 미설치 오류는 'recording' phase 전에 세션을 끝내므로 팁이 숨겨진
|
||||
* 상태다 — 상태 IPC 만 보내면 보이지 않는 창에 그려지고 오류음만 남는다. 이미 떠 있는 팁(녹음 도중
|
||||
* 난 오류)은 자리를 옮기지 않고 상태만 바꾼다.
|
||||
*/
|
||||
export function showRecordingTipError(errorMessage: string): void {
|
||||
if (recordingTipWindow && !recordingTipWindow.isDestroyed() && recordingTipWindow.isVisible()) {
|
||||
updateRecordingTipState('error', { errorMessage })
|
||||
return
|
||||
}
|
||||
showRecordingTip('error', { errorMessage })
|
||||
}
|
||||
|
||||
export function hideRecordingTip(): void {
|
||||
if (recordingTipWindow && !recordingTipWindow.isDestroyed()) {
|
||||
recordingTipWindow.hide()
|
||||
|
|
@ -537,7 +568,7 @@ export function showHistoryPopup(entries: Array<Record<string, unknown>>): void
|
|||
const win = getHistoryPopupWindow()
|
||||
|
||||
// 커서 위치에 즉시 배치+표시 (2-phase 제거 — 숨겨진 윈도우 렌더러 비활성 문제 방지)
|
||||
placePopupNearCursor(win, { width: 380, height: Math.min(60 + entries.length * 44, 500) })
|
||||
placePopupNearCursor(win, historyPopupSize(entries.length))
|
||||
|
||||
sendToPopupWindow(win, IPC_CHANNELS.POPUP_HISTORY.SHOW_ITEMS, { entries, _i18n: getPopupI18nStrings() })
|
||||
|
||||
|
|
@ -572,7 +603,7 @@ export function isHistoryPopupVisible(): boolean {
|
|||
function createCommandPopupWindow(): BrowserWindow {
|
||||
return createPopupWindow({
|
||||
name: 'command-popup',
|
||||
bounds: { width: 340, height: 300 },
|
||||
bounds: commandPopupSize(0),
|
||||
onClosed: () => {
|
||||
commandPopupWindow = null
|
||||
}
|
||||
|
|
@ -588,7 +619,7 @@ export function getCommandPopupWindow(): BrowserWindow {
|
|||
|
||||
export function showCommandPopup(commands: Array<Record<string, unknown>>, activeId: string | null): void {
|
||||
const win = getCommandPopupWindow()
|
||||
placePopupNearCursor(win, { width: 340, height: Math.min(80 + commands.length * 48, 400) })
|
||||
placePopupNearCursor(win, commandPopupSize(commands.length))
|
||||
sendToPopupWindow(win, IPC_CHANNELS.POPUP_COMMAND.SHOW_ITEMS, { commands, activeId, _i18n: getPopupI18nStrings() })
|
||||
|
||||
presentPopup(win)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue