diff --git a/apps/desktop/src/main/utils/paths.ts b/apps/desktop/src/main/utils/paths.ts index 35e7b32..fb8e61b 100644 --- a/apps/desktop/src/main/utils/paths.ts +++ b/apps/desktop/src/main/utils/paths.ts @@ -54,7 +54,7 @@ export function getRecPath(): string { /** * STT sidecar 실행 경로. - * - dev: python/python3 + sidecar/main.py + * - dev: sidecar/.venv/bin/python (있으면) + sidecar/main.py, 없으면 시스템 python3 * - production: sidecar/sidecar(.exe) (PyInstaller 빌드) */ export function getSidecarCommand(): { command: string; args: string[] } { @@ -71,8 +71,19 @@ export function getSidecarCommand(): { command: string; args: string[] } { return { command: pythonCmd, args: [pyPath] } } - // dev: Python 직접 실행 - const sidecarPath = path.join(app.getAppPath(), 'sidecar', 'main.py') + // dev: venv 우선 → 없으면 시스템 python + const sidecarDir = path.join(app.getAppPath(), 'sidecar') + const sidecarPath = path.join(sidecarDir, 'main.py') + + const venvPython = + process.platform === 'win32' + ? path.join(sidecarDir, '.venv', 'Scripts', 'python.exe') + : path.join(sidecarDir, '.venv', 'bin', 'python3') + + if (existsSync(venvPython)) { + return { command: venvPython, args: [sidecarPath] } + } + const pythonCmd = process.platform === 'win32' ? 'python' : 'python3' return { command: pythonCmd, args: [sidecarPath] } } diff --git a/apps/desktop/src/renderer/components/HotkeyRecordModal.tsx b/apps/desktop/src/renderer/components/HotkeyRecordModal.tsx index 8a577a4..a939c5c 100644 --- a/apps/desktop/src/renderer/components/HotkeyRecordModal.tsx +++ b/apps/desktop/src/renderer/components/HotkeyRecordModal.tsx @@ -18,7 +18,7 @@ import { import { d3roPalette } from '@d3ro/ui/theme' import { useI18n } from '@d3ro/i18n' import type { HotkeyBinding } from '@d3ro/core/types' -import { formatHotkeyLabel } from '../utils/format-hotkey' +import { formatHotkeyLabel, getPlatform, keyCodeToName } from '../utils/format-hotkey' // ── 키 이름 매핑 (Windows) ────────────────────────────── const KEY_DISPLAY_MAP: Record = { @@ -55,7 +55,10 @@ const RESERVED_COMBOS = [ const MODIFIER_KEYCODES = new Set([16, 17, 18, 91, 92, 160, 161, 162, 163, 164, 165]) function getKeyName(keyCode: number, key: string): string { - if (KEY_DISPLAY_MAP[keyCode]) return KEY_DISPLAY_MAP[keyCode] + // 플랫폼별 라벨 (macOS는 ⌘/⇧/⌃/⌥). format-hotkey.ts의 단일 매핑을 사용. + const platform = getPlatform() + const mapped = keyCodeToName(keyCode, platform) + if (mapped && !mapped.startsWith('Key')) return mapped if (key.length === 1) return key.toUpperCase() return key } @@ -291,7 +294,12 @@ export function HotkeyRecordModal({ {/* 상태 표시 */} {isReady && !error && ( - {t('hotkey.ready', { keys: captured?.map(k => k.name).join(' + ') ?? '' })} + {t('hotkey.ready', { + keys: + captured + ?.map((k) => k.name) + .join(getPlatform() === 'darwin' ? '' : ' + ') ?? '' + })} )} diff --git a/apps/desktop/src/renderer/utils/format-hotkey.ts b/apps/desktop/src/renderer/utils/format-hotkey.ts index a59a853..0210ebc 100644 --- a/apps/desktop/src/renderer/utils/format-hotkey.ts +++ b/apps/desktop/src/renderer/utils/format-hotkey.ts @@ -7,9 +7,9 @@ import type { HotkeyBinding } from '@d3ro/core/types' -type Platform = 'darwin' | 'win32' | 'linux' +export type Platform = 'darwin' | 'win32' | 'linux' -function getPlatform(): Platform { +export function getPlatform(): Platform { const p = (window as { electronAPI?: { platform?: string } }).electronAPI?.platform if (p === 'darwin' || p === 'win32' || p === 'linux') return p // 폴백: SSR/테스트 환경에서는 navigator.platform로 추정. @@ -18,7 +18,7 @@ function getPlatform(): Platform { } // keyCode → 키명. Windows VK_* 기준 + 일부 macOS 분기. -function keyCodeToName(keyCode: number, platform: Platform): string { +export function keyCodeToName(keyCode: number, platform: Platform = getPlatform()): string { // Modifier 표기 — 플랫폼별 if (platform === 'darwin') { if (keyCode === 16 || keyCode === 160 || keyCode === 161) return '⇧'