知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
fix: a renamed meeting title is saved when you click away or pick another meeting, and shows a pencil on hover
wquguru54388e9dd0a6
diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.stringsindex 22a34d4..5a44d0e 100644--- a/Resources/en.lproj/Localizable.strings+++ b/Resources/en.lproj/Localizable.strings@@ -185,6 +185,7 @@/* AppModel */"准备就绪" = "Ready";"会议室 · %@" = "Room · %@";+"电脑和会议室 · %@" = "Mac + Room · %@";"%@ 转好了" = "%@ is transcribed";"%@ · %lld 句" = "%@ · %lld lines";",正在整理纪要" = ", writing notes";@@ -360,6 +361,7 @@"识别出错,%lld 秒后重试" = "Recognition error; retrying in %lld s";"听不出是哪种语言,到菜单栏里选一下" = "Can't tell the language. Pick one from the menu bar";"正在识别语言…" = "Detecting language…";+"%@ 在听" = "%@ is listening";"翻译暂不可用" = "Translation unavailable for now";/* ListenPill */@@ -638,6 +640,11 @@"德语" = "German";"葡语" = "Portuguese";+/* RecordTitle */+"回车保存,Esc 取消" = "Return to save, Esc to cancel";+"点击改标题" = "Click to rename";+"标题" = "Title";+/* RoomMic */"没有可用的麦克风" = "No microphone available";@@ -920,12 +927,11 @@"选中后自动下载语音模型" = "Downloads its speech model when chosen";"听哪里" = "Listen to";"会议室" = "Room";+"电脑和会议室" = "Mac + Room";"电脑声音" = "This Mac";"电脑声音(线上会议、视频)" = "This Mac (online meetings, videos)";"会议室(用麦克风听桌边的人)" = "Room (the mic hears people at the table)";-"电脑和会议室" = "Mac + Room";"电脑和会议室(线上和桌边的人都听)" = "Mac + Room (people online and at the table)";-"电脑和会议室 · %@" = "Mac + Room · %@";"系统" = "System";"系统麦克风还是 %@" = "System mic is still %@";"别的软件现在听不到你说话" = "Other apps can't hear you now";@@ -995,7 +1001,6 @@"导出…" = "Export…";"完整版纪要" = "Full notes";"速记版纪要" = "Draft notes";-"标题" = "Title";"全部 %lld 句" = "All %lld lines";"翻译中…" = "Translating…";"从这里播放" = "Play from here";@@ -1011,7 +1016,6 @@"听着不像已装的语言" = "Doesn't sound like a language installed here";"听不出是哪种语言,你来选一下" = "Can't tell which language this is. Pick one:";"更多…" = "More…";-"%@ 在听" = "%@ is listening";"正在补装 %@ 语音模型" = "Adding the %@ speech model";"正在下载 %@ 语音模型" = "Downloading the %@ speech model";"已等 %@,比平常慢。可以先交给 %@ 听:声音会发给 %@,整句出字、慢 2–3 秒" = "Waited %1$@, slower than usual. %2$@ can listen meanwhile: the audio goes to %3$@, and lines come whole, 2–3 s late";@@ -1031,9 +1035,9 @@"网络连不上,连上后会自动继续" = "No internet. It carries on once you're back online";"这台 Mac 的磁盘空间不够了" = "This Mac is low on disk space";"这台 Mac 上的语音模型已满 5 种" = "This Mac already holds the most speech models it allows (5)";-"先用已装的:" = "Use one already here:";"打开存储空间" = "Open Storage";"打开听写设置" = "Open Dictation Settings";+"先用已装的:" = "Use one already here:";/* VirtualMic */"%@要安装虚拟麦克风,让会议里的人听到你的翻译。" = "%@ wants to install a virtual microphone so people in the meeting can hear your translation.";diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.stringsindex 878eaaf..71b45f3 100644--- a/Resources/ja.lproj/Localizable.strings+++ b/Resources/ja.lproj/Localizable.strings@@ -185,6 +185,7 @@/* AppModel */"准备就绪" = "準備完了";"会议室 · %@" = "会議室 · %@";+"电脑和会议室 · %@" = "Mac と会議室 · %@";"%@ 转好了" = "%@ の文字起こしが完了";"%@ · %lld 句" = "%@ · %lld文";",正在整理纪要" = "、メモを作成中";@@ -360,6 +361,7 @@"识别出错,%lld 秒后重试" = "認識エラー。%lld秒後に再試行します";"听不出是哪种语言,到菜单栏里选一下" = "言語を判別できません。メニューバーで選んでください";"正在识别语言…" = "言語を検出中…";+"%@ 在听" = "%@ が聞き取り中";"翻译暂不可用" = "現在翻訳を利用できません";/* ListenPill */@@ -638,6 +640,11 @@"德语" = "ドイツ語";"葡语" = "ポルトガル語";+/* RecordTitle */+"回车保存,Esc 取消" = "Return で保存、Esc で取り消し";+"点击改标题" = "クリックしてタイトルを変更";+"标题" = "タイトル";+/* RoomMic */"没有可用的麦克风" = "使用できるマイクがありません";@@ -920,12 +927,11 @@"选中后自动下载语音模型" = "選ぶと音声モデルを自動ダウンロード";"听哪里" = "聞く場所";"会议室" = "会議室";+"电脑和会议室" = "Mac と会議室";"电脑声音" = "この Mac";"电脑声音(线上会议、视频)" = "この Mac(オンライン会議・動画)";"会议室(用麦克风听桌边的人)" = "会議室(マイクでテーブルの声を聞く)";-"电脑和会议室" = "Mac と会議室";"电脑和会议室(线上和桌边的人都听)" = "Mac と会議室(オンラインとテーブルの両方)";-"电脑和会议室 · %@" = "Mac と会議室 · %@";"系统" = "システム";"系统麦克风还是 %@" = "システムのマイクがまだ %@ です";"别的软件现在听不到你说话" = "ほかのアプリにあなたの声が届きません";@@ -995,7 +1001,6 @@"导出…" = "書き出す…";"完整版纪要" = "完全版の議事メモ";"速记版纪要" = "速記版の議事メモ";-"标题" = "タイトル";"全部 %lld 句" = "全%lld文";"翻译中…" = "翻訳中…";"从这里播放" = "ここから再生";@@ -1011,7 +1016,6 @@"听着不像已装的语言" = "入っている言語ではなさそうです";"听不出是哪种语言,你来选一下" = "言語を判別できません。選んでください";"更多…" = "その他…";-"%@ 在听" = "%@ が聞き取り中";"正在补装 %@ 语音模型" = "%@ の音声モデルを追加中";"正在下载 %@ 语音模型" = "%@ の音声モデルをダウンロード中";"已等 %@,比平常慢。可以先交给 %@ 听:声音会发给 %@,整句出字、慢 2–3 秒" = "%1$@ 待機中。いつもより遅めです。先に %2$@ で聞き取れます:音声は %3$@ に送られ、文単位で 2〜3 秒遅れて表示されます";@@ -1031,9 +1035,9 @@"网络连不上,连上后会自动继续" = "ネットワークに接続できません。つながると自動で続けます";"这台 Mac 的磁盘空间不够了" = "この Mac のディスク容量が足りません";"这台 Mac 上的语音模型已满 5 种" = "この Mac の音声モデルが上限の 5 つに達しています";-"先用已装的:" = "入っている言語で続ける:";"打开存储空间" = "ストレージを開く";"打开听写设置" = "音声入力の設定を開く";+"先用已装的:" = "入っている言語で続ける:";/* VirtualMic */"%@要安装虚拟麦克风,让会议里的人听到你的翻译。" = "%@は仮想マイクをインストールし、会議の参加者にあなたの翻訳を聞こえるようにします。";diff --git a/Resources/ko.lproj/Localizable.strings b/Resources/ko.lproj/Localizable.stringsindex 1de94c7..eea5f3b 100644--- a/Resources/ko.lproj/Localizable.strings+++ b/Resources/ko.lproj/Localizable.strings@@ -185,6 +185,7 @@/* AppModel */"准备就绪" = "준비 완료";"会议室 · %@" = "회의실 · %@";+"电脑和会议室 · %@" = "Mac과 회의실 · %@";"%@ 转好了" = "%@ 받아쓰기 완료";"%@ · %lld 句" = "%@ · %lld문장";",正在整理纪要" = ", 노트 작성 중";@@ -360,6 +361,7 @@"识别出错,%lld 秒后重试" = "인식 오류, %lld초 후 다시 시도합니다";"听不出是哪种语言,到菜单栏里选一下" = "언어를 알 수 없어요. 메뉴 막대에서 골라 주세요";"正在识别语言…" = "언어 감지 중…";+"%@ 在听" = "%@ 이(가) 듣는 중";"翻译暂不可用" = "번역을 일시적으로 사용할 수 없음";/* ListenPill */@@ -638,6 +640,11 @@"德语" = "독일어";"葡语" = "포르투갈어";+/* RecordTitle */+"回车保存,Esc 取消" = "Return로 저장, Esc로 취소";+"点击改标题" = "클릭해서 제목 변경";+"标题" = "제목";+/* RoomMic */"没有可用的麦克风" = "사용할 수 있는 마이크가 없습니다";@@ -920,12 +927,11 @@"选中后自动下载语音模型" = "선택하면 음성 모델을 자동 다운로드";"听哪里" = "듣는 곳";"会议室" = "회의실";+"电脑和会议室" = "Mac과 회의실";"电脑声音" = "이 Mac";"电脑声音(线上会议、视频)" = "이 Mac (온라인 회의, 동영상)";"会议室(用麦克风听桌边的人)" = "회의실 (마이크로 테이블의 목소리를 들어요)";-"电脑和会议室" = "Mac과 회의실";"电脑和会议室(线上和桌边的人都听)" = "Mac과 회의실 (온라인과 테이블 모두)";-"电脑和会议室 · %@" = "Mac과 회의실 · %@";"系统" = "시스템";"系统麦克风还是 %@" = "시스템 마이크가 아직 %@예요";"别的软件现在听不到你说话" = "다른 앱에 내 목소리가 들리지 않아요";@@ -995,7 +1001,6 @@"导出…" = "내보내기…";"完整版纪要" = "전체본 회의록";"速记版纪要" = "속기본 회의록";-"标题" = "제목";"全部 %lld 句" = "전체 %lld문장";"翻译中…" = "번역 중…";"从这里播放" = "여기서부터 재생";@@ -1011,7 +1016,6 @@"听着不像已装的语言" = "설치된 언어가 아닌 것 같아요";"听不出是哪种语言,你来选一下" = "어떤 언어인지 알 수 없어요. 골라 주세요";"更多…" = "더 보기…";-"%@ 在听" = "%@ 이(가) 듣는 중";"正在补装 %@ 语音模型" = "%@ 음성 모델 추가 중";"正在下载 %@ 语音模型" = "%@ 음성 모델 다운로드 중";"已等 %@,比平常慢。可以先交给 %@ 听:声音会发给 %@,整句出字、慢 2–3 秒" = "%1$@ 기다림. 평소보다 느립니다. 그동안 %2$@이(가) 들을 수 있어요: 음성이 %3$@에 전송되고, 문장 단위로 2–3초 늦게 나옵니다";@@ -1031,9 +1035,9 @@"网络连不上,连上后会自动继续" = "네트워크에 연결할 수 없어요. 연결되면 자동으로 계속해요";"这台 Mac 的磁盘空间不够了" = "이 Mac의 디스크 공간이 부족해요";"这台 Mac 上的语音模型已满 5 种" = "이 Mac의 음성 모델이 최대 5개에 도달했어요";-"先用已装的:" = "설치된 언어로 계속:";"打开存储空间" = "저장 공간 열기";"打开听写设置" = "받아쓰기 설정 열기";+"先用已装的:" = "설치된 언어로 계속:";/* VirtualMic */"%@要安装虚拟麦克风,让会议里的人听到你的翻译。" = "%@이(가) 가상 마이크를 설치하려 합니다. 회의 참석자가 내 번역을 들을 수 있게 하기 위해서입니다.";diff --git a/Resources/zh-Hans.lproj/Localizable.strings b/Resources/zh-Hans.lproj/Localizable.stringsindex 50168cd..8268009 100644--- a/Resources/zh-Hans.lproj/Localizable.strings+++ b/Resources/zh-Hans.lproj/Localizable.strings@@ -185,6 +185,7 @@/* AppModel */"准备就绪" = "准备就绪";"会议室 · %@" = "会议室 · %@";+"电脑和会议室 · %@" = "电脑和会议室 · %@";"%@ 转好了" = "%@ 转好了";"%@ · %lld 句" = "%@ · %lld 句";",正在整理纪要" = ",正在整理纪要";@@ -360,6 +361,7 @@"识别出错,%lld 秒后重试" = "识别出错,%lld 秒后重试";"听不出是哪种语言,到菜单栏里选一下" = "听不出是哪种语言,到菜单栏里选一下";"正在识别语言…" = "正在识别语言…";+"%@ 在听" = "%@ 在听";"翻译暂不可用" = "翻译暂不可用";/* ListenPill */@@ -638,6 +640,11 @@"德语" = "德语";"葡语" = "葡语";+/* RecordTitle */+"回车保存,Esc 取消" = "回车保存,Esc 取消";+"点击改标题" = "点击改标题";+"标题" = "标题";+/* RoomMic */"没有可用的麦克风" = "没有可用的麦克风";@@ -920,9 +927,11 @@"选中后自动下载语音模型" = "选中后自动下载语音模型";"听哪里" = "听哪里";"会议室" = "会议室";+"电脑和会议室" = "电脑和会议室";"电脑声音" = "电脑声音";"电脑声音(线上会议、视频)" = "电脑声音(线上会议、视频)";"会议室(用麦克风听桌边的人)" = "会议室(用麦克风听桌边的人)";+"电脑和会议室(线上和桌边的人都听)" = "电脑和会议室(线上和桌边的人都听)";"系统" = "系统";"系统麦克风还是 %@" = "系统麦克风还是 %@";"别的软件现在听不到你说话" = "别的软件现在听不到你说话";@@ -992,7 +1001,6 @@"导出…" = "导出…";"完整版纪要" = "完整版纪要";"速记版纪要" = "速记版纪要";-"标题" = "标题";"全部 %lld 句" = "全部 %lld 句";"翻译中…" = "翻译中…";"从这里播放" = "从这里播放";@@ -1008,7 +1016,6 @@"听着不像已装的语言" = "听着不像已装的语言";"听不出是哪种语言,你来选一下" = "听不出是哪种语言,你来选一下";"更多…" = "更多…";-"%@ 在听" = "%@ 在听";"正在补装 %@ 语音模型" = "正在补装 %@ 语音模型";"正在下载 %@ 语音模型" = "正在下载 %@ 语音模型";"已等 %@,比平常慢。可以先交给 %@ 听:声音会发给 %@,整句出字、慢 2–3 秒" = "已等 %@,比平常慢。可以先交给 %@ 听:声音会发给 %@,整句出字、慢 2–3 秒";@@ -1028,9 +1035,9 @@"网络连不上,连上后会自动继续" = "网络连不上,连上后会自动继续";"这台 Mac 的磁盘空间不够了" = "这台 Mac 的磁盘空间不够了";"这台 Mac 上的语音模型已满 5 种" = "这台 Mac 上的语音模型已满 5 种";-"先用已装的:" = "先用已装的:";"打开存储空间" = "打开存储空间";"打开听写设置" = "打开听写设置";+"先用已装的:" = "先用已装的:";/* VirtualMic */"%@要安装虚拟麦克风,让会议里的人听到你的翻译。" = "%@要安装虚拟麦克风,让会议里的人听到你的翻译。";diff --git a/Sources/Cicada/RecordTitle.swift b/Sources/Cicada/RecordTitle.swiftnew file mode 100644index 0000000..9cd9e5a--- /dev/null+++ b/Sources/Cicada/RecordTitle.swift@@ -0,0 +1,105 @@+import AppKit+import SwiftUI++/// The record's big title, edited in place: hovering shows it can be clicked, and leaving the field+/// saves as Return does (people clicked away and lost the change). Cleared, it goes back to the+/// automatic title; Esc puts back what was there.+struct RecordTitleField: View {+ let session: Session+ @ObservedObject var store: SessionStore+ /// What the field holds while editing; nil shows the record's title.+ @State private var draft: String?+ /// The title as editing began: saving it unchanged must not rename (the field shows `listTitle`,+ /// which can differ from the stored title).+ @State private var original = ""+ @State private var cancelled = false+ @State private var hovering = false+ @FocusState private var focused: Bool++ var body: some View {+ VStack(alignment: .leading, spacing: 6) {+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ TextField("标题", text: Binding(+ // The date is on the line above; a notes title that starts with it shows without.+ get: { draft ?? RecordList.listTitle(session) },+ set: { draft = $0 }+ ), axis: .vertical)+ .textFieldStyle(.plain)+ .font(.system(size: 26, weight: .semibold))+ .focused($focused)+ .onSubmit { focused = false }+ .onExitCommand {+ cancelled = true+ focused = false+ }+ if hovering, !focused {+ Image(systemName: "pencil").font(.system(size: 14, weight: .medium)).foregroundStyle(Palette.tertiary)+ .accessibilityHidden(true)+ }+ }+ .padding(.horizontal, 8).padding(.vertical, 2)+ .background(RoundedRectangle(cornerRadius: 8).fill(hovering && !focused ? Palette.fill : .clear))+ .overlay(RoundedRectangle(cornerRadius: 8).stroke(Palette.ink, lineWidth: focused ? 2 : 0))+ .padding(.horizontal, -8)+ .onHover { hovering = $0 }+ .help(focused ? "" : L("点击改标题"))+ if focused {+ Text("回车保存,Esc 取消").font(.system(size: 12)).foregroundStyle(Palette.tertiary)+ }+ }+ .background(GeometryReader { g in Color.clear.preference(key: TitleFrameKey.self, value: g.frame(in: .global)) })+ .onPreferenceChange(TitleFrameKey.self) { frame in clicks.frame = frame }+ .onChange(of: focused) { _, now in+ if now {+ original = RecordList.listTitle(session)+ draft = original+ cancelled = false+ // A click on the page around it doesn't take focus from a text field on macOS: watch for it.+ clicks.start { focused = false }+ } else {+ clicks.stop()+ commit()+ }+ }+ // Picking another meeting replaces this view before focus is lost: save what was typed.+ .onDisappear {+ clicks.stop()+ if draft != nil { commit() }+ }+ }++ @StateObject private var clicks = ClickOutside()++ @MainActor private func commit() {+ defer { draft = nil; cancelled = false }+ guard !cancelled, let d = draft?.trimmingCharacters(in: .whitespacesAndNewlines), d != original else { return }+ store.rename(session.id, to: d)+ }+}++private struct TitleFrameKey: PreferenceKey {+ static let defaultValue: CGRect = .zero+ static func reduce(value: inout CGRect, nextValue: () -> CGRect) { value = nextValue() }+}++/// While the title is being edited: a click in the same window outside it ends the editing.+@MainActor final class ClickOutside: ObservableObject {+ /// The field in SwiftUI global space (the window's content, top-left origin).+ var frame: CGRect = .zero+ private var monitor: Any?++ func start(_ outside: @escaping () -> Void) {+ stop()+ monitor = NSEvent.addLocalMonitorForEvents(matching: .leftMouseDown) { [weak self] event in+ guard let self, let window = event.window, window === NSApp.keyWindow, let content = window.contentView else { return event }+ let p = CGPoint(x: event.locationInWindow.x, y: content.bounds.height - event.locationInWindow.y)+ if !self.frame.contains(p) { DispatchQueue.main.async { outside() } }+ return event+ }+ }++ func stop() {+ if let monitor { NSEvent.removeMonitor(monitor) }+ monitor = nil+ }+}diff --git a/Sources/Cicada/Views.swift b/Sources/Cicada/Views.swiftindex 1976c7c..4e3a0c3 100644--- a/Sources/Cicada/Views.swift+++ b/Sources/Cicada/Views.swift@@ -690,7 +690,6 @@ struct MainWindowView: View {@State private var selection: String?@State private var query = ""@State private var view = "both"- @State private var titleDraft = ""@State private var tab = "notes"@State private var jumpTo: Double?/// A topic's time picked in the notes, for the bilingual column beside them.@@ -815,7 +814,6 @@ struct MainWindowView: View {let live = s.id == store.liveIDreturn Button {selection = s.id- titleDraft = ""} label: {// Titles only: the time and length are on the page (and in the tooltip). Unpicked rows// stay grey so the one being read stands out.@@ -913,7 +911,6 @@ struct MainWindowView: View {}if s.id == store.liveID { liveNow }}- .onChange(of: s.id) { _, _ in titleDraft = "" }} else {welcome}@@ -1046,18 +1043,7 @@ struct MainWindowView: View {.font(.system(size: 12).monospacedDigit()).foregroundStyle(Palette.tertiary).lineLimit(1).help(([dateLine(s, live: live)] + more.compactMap { $0 }).joined(separator: " · "))}- TextField("标题", text: Binding(- // The date is on the line above; a notes title that starts with it shows without.- get: { titleDraft.isEmpty ? RecordList.listTitle(s) : titleDraft },- set: { titleDraft = $0 }- ), axis: .vertical)- .textFieldStyle(.plain)- .font(.system(size: 26, weight: .semibold))- .padding(.top, 8)- .onSubmit {- if !titleDraft.isEmpty { store.rename(s.id, to: titleDraft) }- titleDraft = ""- }+ RecordTitleField(session: s, store: store).id(s.id).padding(.top, 8)if s.sourcePath != nil {VStack(alignment: .leading, spacing: 12) {if s.fromRecording, s.lines.isEmpty || s.importing == true, !working(s) {diff --git a/site/changelog.json b/site/changelog.jsonindex ed74325..3fe8ee2 100644--- a/site/changelog.json+++ b/site/changelog.json@@ -53,6 +53,14 @@],"title": "会议里有人敲键盘,不再被当成有人在说话。","text": "一下下的按键声会打断静音,知了等不到停顿:换语言的判断和会议结束的提示都会推迟。"+ },+ {+ "kind": "improved",+ "platforms": [+ "mac"+ ],+ "title": "会议标题点一下就能改,改完点别处也会保存。",+ "text": "鼠标移到标题上会出现铅笔;回车或点别处保存,Esc 取消;清空就换回自动标题。原来不按回车直接点别处,改的标题会丢。"}]},