Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,12 @@ agent-browser connect 9222
- `HOME` の付け替えは要らない(Windows の userData は `--user-data-dir` だけで決まる)。
- `electron out/main/index.js` で起動すると、「このアプリについて」の版は Electron の版になる
(package.json の無い `out/main` がアプリのパスになるため)。`npm run dev` なら正しい。
- ウィンドウ枠ごと撮る `screencapture` に当たるものは無い。ページの描画は `agent-browser screenshot` で撮る。
- ウィンドウ枠ごと撮る `screencapture` に当たるものは無い。ページの描画は `agent-browser screenshot` で撮る。枠やメニューバーまで
見るときは、PowerShell で `GetWindowRect` と `Graphics.CopyFromScreen` を使い、**アプリのウィンドウの範囲だけ**を撮る
(画面全体を撮ると、利用者が開いている別の内容が写り込む)。
- 通知は画面を撮らずに、`ToastNotificationManager.History.GetHistory('io.github.eddybean.exolobe')` で中身(本文・ボタン)を読む。
- このセッションから送ったキー入力(`keybd_event` / SendKeys)では、グローバルショートカットが反応しなかった。登録できているかは、
同じ組み合わせを `RegisterHotKey` で取りに行き、失敗する(Exolobe が握っている)ことで確かめ、押したときの動きは手で確かめる。
- **agent-browser の出力をパイプに通さない**(`| head` など)。最初の呼び出しで起動する常駐プロセスがパイプを
握ったままになり、コマンドが返らない。見たいときはファイルへリダイレクトしてから読む。
- `npm install -g agent-browser` を mise の Node で入れたら `mise reshim` する。しないと PATH に出てこない。
Expand Down
6 changes: 6 additions & 0 deletions docs/decisions.html
Original file line number Diff line number Diff line change
Expand Up @@ -4456,6 +4456,12 @@ <h4>残した判断</h4>
変換とチャンネルの混ぜ合わせは Source Reader に任せた(左右に別の音を入れたステレオで、両方が残ることを確かめた)。
読める形式は afconvert と違い、webm / mkv / mov / wma / avi を読み、ogg / opus / aiff / caf を読まない(実機で確認)。
webm の Opus のように、ストアの拡張機能が入っているかで変わるものもある。</li>
<li>画面・メニュー・トレイ・通知を Windows 11 の実機で見た(2026-10)。ウィンドウは標準の枠で、ナビとも重ならない。メニューバーは出したまま
(autoHideMenuBar にしない。録音の操作をメニューからも辿れるようにするため)。Windows では役割のメニューが Electron の既定の英語のまま
出て日英が混ざったので、役割の項目にも UI の言語の名前とアクセスキーを付ける(macOS は OS の訳に任せる)。トレイの待機中のアイコンは
テンプレート画像が効かず黒のままで、ダークのタスクバーで見えなかったので、タスクバーの明暗に合わせて白く塗る。左クリックでウィンドウ、
右クリックでメニュー(Windows の慣例)。ウィンドウを閉じても終わらず、二重起動でウィンドウが戻る。通知は Electron 44 が Windows の
トーストにもボタンを付けるので、トーストの XML は自前で書かない。書体は和文が Yu Gothic UI、等幅が Consolas で描かれる。</li>
<li>要約・チャット・意味検索(node-llama-cpp)と話者識別(sherpa-onnx-node)を Windows 11(RTX 5090、RAM 64GB)で動かした(2026-10)。
54 分・3 話者の合成会議で、文字起こし・話者識別・要約・エンコードが通り、チャットは引用付きで答え、意味検索も答えた。
ワーカーはジョブの後・使われなくなった後に終わり、VRAM も元に戻る(ADR-008)。声紋の取り出し(enableExternalBuffer = false)も Electron の中で通った。
Expand Down
50 changes: 50 additions & 0 deletions src/main/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ const ja = {
view: '表示',
openDocs: 'ドキュメントを開く'
},
/**
* Windows のメニューバー。macOS は役割のメニューを OS が訳すが、Windows では Electron の既定(英語)の
* まま出るので、役割の項目にも名前を付ける。(&F) などは Alt キーで開くためのアクセスキー。
*/
windowsMenu: {
file: 'ファイル(&F)',
recording: '録音(&R)',
edit: '編集(&E)',
view: '表示(&V)',
window: 'ウィンドウ(&W)',
help: 'ヘルプ(&H)',
quit: '終了',
undo: '元に戻す',
redo: 'やり直し',
cut: '切り取り',
copy: 'コピー',
paste: '貼り付け',
selectAll: 'すべて選択',
reload: '再読み込み',
toggleDevTools: '開発者ツール',
resetZoom: '実際のサイズ',
zoomIn: '拡大',
zoomOut: '縮小',
togglefullscreen: '全画面表示',
minimize: '最小化',
close: '閉じる'
},
tray: {
recording: (title: string) => `録音中: ${title}`,
idle: '停止中',
Expand Down Expand Up @@ -111,6 +138,29 @@ const en: MainMessages = {
view: 'View',
openDocs: 'Open Documentation'
},
windowsMenu: {
file: '&File',
recording: '&Recording',
edit: '&Edit',
view: '&View',
window: '&Window',
help: '&Help',
quit: 'Exit',
undo: 'Undo',
redo: 'Redo',
cut: 'Cut',
copy: 'Copy',
paste: 'Paste',
selectAll: 'Select All',
reload: 'Reload',
toggleDevTools: 'Developer Tools',
resetZoom: 'Actual Size',
zoomIn: 'Zoom In',
zoomOut: 'Zoom Out',
togglefullscreen: 'Full Screen',
minimize: 'Minimize',
close: 'Close'
},
tray: {
recording: (title: string) => `Recording: ${title}`,
idle: 'Not Recording',
Expand Down
4 changes: 4 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { registerIpcHandlers } from './ipc/handlers'
import { createApplicationMenu } from './menu'
import { createTray } from './tray'
import { claimSingleInstance } from './singleInstance'
import appIcon from '../../build/icon.png?asset'

/**
* アプリのエントリポイント。
Expand Down Expand Up @@ -42,6 +43,9 @@ const createWindow = (): BrowserWindow => {
// macOS は信号機ボタンだけを残してナビゲーションをタイトルバーに重ねる。hiddenInset は macOS 専用で、
// Windows に渡すと最小化・閉じるのボタンごと消えるので、Windows は標準の枠のままにする(ADR-048)。
...(process.platform === 'darwin' ? { titleBarStyle: 'hiddenInset' as const } : {}),
// Windows はウィンドウの左上とタスクバーにアイコンを出す。指定しないと、開発中は Electron の既定のアイコンになる。
// macOS のウィンドウにはアイコンが出ず、Dock はアプリのアイコンを使うので渡さない。
...(process.platform === 'darwin' ? {} : { icon: appIcon }),
webPreferences: {
preload: join(__dirname, '../preload/index.js'),
sandbox: false,
Expand Down
138 changes: 85 additions & 53 deletions src/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,76 @@ import { toAppPlatform, type AppPlatform } from '@shared/platform'
export const leadingMenuRole = (platform: AppPlatform): 'appMenu' | 'fileMenu' =>
platform === 'windows' ? 'fileMenu' : 'appMenu'

export interface MenuActions {
readonly start: () => void
readonly stop: () => void
readonly showWindow: () => void
readonly openDocs: () => void
}

type Role = NonNullable<MenuItemConstructorOptions['role']>
type WindowsLabels = ReturnType<typeof text>['windowsMenu']

/**
* 役割の項目。Windows では Electron の既定の名前(英語)が出るので UI の言語の名前を付け、
* macOS は OS の訳に任せて名前を付けない。
*/
const roleItem = (role: Role & keyof WindowsLabels, platform: AppPlatform): MenuItemConstructorOptions =>
platform === 'windows' ? { role, label: text().windowsMenu[role] } : { role }

/**
* Windows で役割の「メニュー」(fileMenu など)を使わずに組む中身。役割のメニューは中の項目まで
* 英語の名前で作られるため、項目を並べて名前を付ける。
*/
const windowsSubmenu = (label: string, roles: readonly (Role & keyof WindowsLabels)[]): MenuItemConstructorOptions => ({
label,
submenu: roles.map((role) => roleItem(role, 'windows'))
})

/** メニューの中身。Electron に触らない純粋な関数にして、OS ごとの違いをテストで確かめる。 */
export const applicationMenuTemplate = (params: {
platform: AppPlatform
active: boolean
actions: MenuActions
}): MenuItemConstructorOptions[] => {
const { platform, active, actions } = params
const windows = platform === 'windows'
const w = text().windowsMenu

return [
windows ? windowsSubmenu(w.file, ['quit']) : { role: leadingMenuRole(platform) },
{
label: windows ? w.recording : text().menu.recording,
submenu: [
{ label: text().menu.start, accelerator: 'CmdOrCtrl+R', enabled: !active, click: actions.start },
{ label: text().menu.stop, accelerator: 'CmdOrCtrl+.', enabled: active, click: actions.stop },
{ type: 'separator' },
{ label: text().menu.showWindow, accelerator: 'CmdOrCtrl+0', click: actions.showWindow }
]
},
windows ? windowsSubmenu(w.edit, ['undo', 'redo', 'cut', 'copy', 'paste', 'selectAll']) : { role: 'editMenu' },
{
label: windows ? w.view : text().menu.view,
submenu: [
roleItem('reload', platform),
roleItem('toggleDevTools', platform),
{ type: 'separator' },
roleItem('resetZoom', platform),
roleItem('zoomIn', platform),
roleItem('zoomOut', platform),
{ type: 'separator' },
roleItem('togglefullscreen', platform)
]
},
windows ? windowsSubmenu(w.window, ['minimize', 'close']) : { role: 'windowMenu' },
{
role: 'help',
...(windows ? { label: w.help } : {}),
submenu: [{ label: text().menu.openDocs, click: actions.openDocs }]
}
]
}

/**
* アプリケーションメニュー。
*
Expand All @@ -21,60 +91,22 @@ export const leadingMenuRole = (platform: AppPlatform): 'appMenu' | 'fileMenu' =
* 状態の変化を個別に監視するより、その都度組み立てた方が確実にずれない。
*/
export const createApplicationMenu = (controller: TransportController, showWindow: () => void): void => {
const build = (): Menu => {
const active = controller.state().active

const template: MenuItemConstructorOptions[] = [
{ role: leadingMenuRole(toAppPlatform(process.platform)) },
{
label: text().menu.recording,
submenu: [
{
label: text().menu.start,
accelerator: 'CmdOrCtrl+R',
enabled: !active,
click: () => controller.request('start')
},
{
label: text().menu.stop,
accelerator: 'CmdOrCtrl+.',
enabled: active,
click: () => controller.request('stop')
},
{ type: 'separator' },
{ label: text().menu.showWindow, accelerator: 'CmdOrCtrl+0', click: showWindow }
]
},
{ role: 'editMenu' },
{
label: text().menu.view,
submenu: [
{ role: 'reload' },
{ role: 'toggleDevTools' },
{ type: 'separator' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
},
{ role: 'windowMenu' },
{
role: 'help',
submenu: [
{
label: text().menu.openDocs,
click: () => {
void shell.openExternal('https://github.com/eddybean/exolobe/tree/main/docs')
}
}
]
}
]

return Menu.buildFromTemplate(template)
const actions: MenuActions = {
start: () => controller.request('start'),
stop: () => controller.request('stop'),
showWindow,
openDocs: () => {
void shell.openExternal('https://github.com/eddybean/exolobe/tree/main/docs')
}
}
const build = (): Menu =>
Menu.buildFromTemplate(
applicationMenuTemplate({
platform: toAppPlatform(process.platform),
active: controller.state().active,
actions
})
)

Menu.setApplicationMenu(build())

Expand Down
39 changes: 28 additions & 11 deletions src/main/tray.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
import { Menu, Tray, nativeImage, type NativeImage } from 'electron'
import { Menu, Tray, nativeImage, nativeTheme, type NativeImage } from 'electron'
import type { TransportController } from './ipc/handlers'
import { trayIconFor } from './trayIcon'
import { trayIconFor, whitenBitmap, type TrayAppearance } from './trayIcon'
import { text } from './i18n'
import { toAppPlatform } from '@shared/platform'

/**
* メニューバーからの録音操作。
*
* 会議中はウィンドウを閉じている(あるいは他アプリの背後にある)ことが多いため、
* 開始・停止だけはウィンドウ無しでも常に届く場所に置く。
*/
const iconFor = (recording: boolean): NativeImage => {
const choice = trayIconFor(recording)
const iconFor = (recording: boolean, appearance: TrayAppearance): NativeImage => {
const choice = trayIconFor(recording, appearance)
// 32x32 を scaleFactor 2 として渡すと、16pt のアイコンとして扱われ Retina で滲まない。
const icon = nativeImage.createFromBuffer(Buffer.from(choice.pngBase64, 'base64'), {
width: 32,
height: 32,
scaleFactor: 2
})
// 待機中はテンプレート画像にしてライト/ダークに自動で色を合わせ、録音中は赤をそのまま見せる。
const size = { width: 32, height: 32, scaleFactor: 2 }
const decoded = nativeImage.createFromBuffer(Buffer.from(choice.pngBase64, 'base64'), size)
const icon = choice.whiten ? nativeImage.createFromBitmap(whitenBitmap(decoded.toBitmap()), size) : decoded
// macOS の待機中はテンプレート画像にしてライト/ダークに自動で色を合わせ、録音中は赤をそのまま見せる。
icon.setTemplateImage(choice.template)
return icon
}

/** いまのタスクバー(メニューバー)の見た目。Windows のタスクバーはアプリの外観と別に明暗を持つ。 */
const currentAppearance = (): TrayAppearance => ({
platform: toAppPlatform(process.platform),
darkTaskbar: nativeTheme.shouldUseDarkColorsForSystemIntegratedUI
})

export const createTray = (controller: TransportController, showWindow: () => void): Tray => {
const icons = { idle: iconFor(false), recording: iconFor(true) }
const makeIcons = (): { idle: NativeImage; recording: NativeImage } => {
const appearance = currentAppearance()
return { idle: iconFor(false, appearance), recording: iconFor(true, appearance) }
}
let icons = makeIcons()

const tray = new Tray(icons.idle)
tray.setToolTip('Exolobe')
// Windows ではトレイのアイコンを左クリックしたらウィンドウを出すのが慣例(右クリックはメニュー)。
// macOS はクリックでメニューを出すのが慣例なので、そのままにする。
if (process.platform === 'win32') tray.on('click', showWindow)

const refresh = (): void => {
const state = controller.state()
Expand All @@ -53,6 +65,11 @@ export const createTray = (controller: TransportController, showWindow: () => vo
}

refresh()
// タスクバーの明暗が変わったら、待機中のアイコンの色を合わせ直す(Windows)。
nativeTheme.on('updated', () => {
icons = makeIcons()
refresh()
})
// 録音状態が変わったら表示を追従させる。クリック時だけの更新では、
// ウィンドウ側で停止したときにトレイの表示が古いままになる。
controller.onStateChanged(refresh)
Expand Down
43 changes: 39 additions & 4 deletions src/main/trayIcon.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { AppPlatform } from '@shared/platform'

/**
* メニューバー用のアイコン。アプリアイコンと同じ「二本の軌跡」で、
* 中心線の上下に波形を分けて置く(上=相手、下=自分)。
Expand Down Expand Up @@ -29,9 +31,42 @@ export interface TrayIconChoice {
readonly pngBase64: string
/** テンプレート画像にすると OS が単色に塗り直すため、色を見せたいときは外す。 */
readonly template: boolean
/** 白く塗ってから使う(whitenBitmap)。 */
readonly whiten: boolean
}

/** アイコンを置く場所の見た目。Windows はタスクバー、macOS はメニューバー。 */
export interface TrayAppearance {
readonly platform: AppPlatform
/** タスクバーがダークか。macOS は OS が塗り直すので見ない。 */
readonly darkTaskbar: boolean
}

export const trayIconFor = (recording: boolean): TrayIconChoice =>
recording
? { pngBase64: TRAY_ICON_RECORDING_PNG_BASE64, template: false }
: { pngBase64: TRAY_ICON_PNG_BASE64, template: true }
/**
* 待機中と録音中で使う画像。
*
* macOS の待機中はテンプレート画像にして OS に明暗を合わせさせる。Windows は setTemplateImage が効かず、
* 黒いままだとダークのタスクバーで見えなくなるので、タスクバーの明暗に合わせて待機中だけ白く塗る(ADR-048)。
* 録音中は、どちらでも赤をそのまま見せる。
*/
export const trayIconFor = (recording: boolean, appearance: TrayAppearance): TrayIconChoice => {
if (recording) return { pngBase64: TRAY_ICON_RECORDING_PNG_BASE64, template: false, whiten: false }
if (appearance.platform === 'macos') return { pngBase64: TRAY_ICON_PNG_BASE64, template: true, whiten: false }
return { pngBase64: TRAY_ICON_PNG_BASE64, template: false, whiten: appearance.darkTaskbar }
}

/**
* 4 バイト 1 画素(BGRA)の画像を、形(透明度)を保ったまま白く塗る。
* 色は透明度と同じ値にする。nativeImage の画素が透明度を乗算済みでも、乗算前でも白く見える
* (乗算前なら縁がわずかに暗くなるだけで、ダークのタスクバーでは目立たない)。
*/
export const whitenBitmap = (bitmap: Buffer): Buffer => {
const out = Buffer.from(bitmap)
for (let i = 0; i + 3 < out.length; i += 4) {
const alpha = out[i + 3] ?? 0
out[i] = alpha
out[i + 1] = alpha
out[i + 2] = alpha
}
return out
}
6 changes: 6 additions & 0 deletions src/renderer/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,12 @@ textarea:focus {
margin-top: 12px;
}

/* 横に並ぶ説明が長い(英語)と、狭い幅でボタンの方が押し縮められて 2 行に折れる。折り返すのは説明だけにする。 */
.permissions__test > button {
flex-shrink: 0;
white-space: nowrap;
}

.permissions__results {
list-style: none;
margin: 12px 0 0;
Expand Down
2 changes: 2 additions & 0 deletions src/types/electron-vite-assets.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// main から `?asset` で読み込むファイル(ビルド時に出力先へ写され、実行時のパスになる)の型。
/// <reference types="electron-vite/node" />
Loading
Loading