知了 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
feat: Click 正在听 at the top of the records window to bring back the live notes or subtitle bar
wquguru366cee04c2f9
diff --git a/Sources/LiveSubs/AppModel.swift b/Sources/LiveSubs/AppModel.swiftindex 43cce85..44f00ac 100644--- a/Sources/LiveSubs/AppModel.swift+++ b/Sources/LiveSubs/AppModel.swift@@ -659,9 +659,14 @@ final class AppModel: ObservableObject {}}- func openNotesWindow() {- if settings.displayMode != "notes" { setDisplayMode("notes") }- notesWindow.show()+ /// Asked for by name (菜单栏面板 打开, 窗口 › 实时纪要): shown even before anyone speaks, and+ /// without touching 显示方式, so 不显示 or 字幕条 is back at the next meeting.+ func openNotesWindow() { notesWindow.show() }++ /// The listening pill: bring back what shows this meeting, the subtitle bar in 字幕条 mode,+ /// else the notes window (in 不显示 just this once).+ func showLiveDisplay() {+ if settings.displayMode == "bar" { overlay.reveal() } else { openNotesWindow() }}/// 收起 in the menu bar panel: out of the way for now, still in 实时纪要 mode@@ -1412,6 +1417,13 @@ final class AppModel: ObservableObject {try? png.write(to: URL(fileURLWithPath: arg))}case "mainShow": mainShow = arg+ case "mainWindow":+ // Place the records window, floating above other apps' panels while testing clicks (no arg: back to normal).+ guard let w = NSApp.windows.first(where: { $0.contentView is NSHostingView<MainWindowView> }) else { break }+ let v = arg.split(separator: ",").compactMap { Double($0) }+ if v.count == 4 { w.setFrame(NSRect(x: v[0], y: v[1], width: v[2], height: v[3]), display: true) }+ w.level = v.count == 4 ? .floating : .normal+ w.orderFrontRegardless()case "mainRender":// The main window as drawn, for checking it without Screen Recording permission.guard let view = NSApp.windows.first(where: { $0.contentView is NSHostingView<MainWindowView> })?.contentView,@@ -1531,6 +1543,7 @@ final class AppModel: ObservableObject {if n.count == 4 { overlay.place(x: n[0], y: n[1], width: n[2], fontSize: n[3]) }case "overlayState": debugLog("overlay \(overlay.stateDescription)")case "overlayToggle": overlay.toggleManual()+ case "pillClick": showLiveDisplay()case "overlayAuto": setOverlayAuto(arg != "off")case "hideAfter": settings.overlayHideAfter = Double(arg) ?? 4case "frame":diff --git a/Sources/LiveSubs/ListenPill.swift b/Sources/LiveSubs/ListenPill.swiftindex d788881..44b5888 100644--- a/Sources/LiveSubs/ListenPill.swift+++ b/Sources/LiveSubs/ListenPill.swift@@ -102,14 +102,19 @@ struct ListenPill: View {private var listening: some View {HStack(spacing: 10) {- Button { model.requestStop() } label: { BreathingMark(size: 22) }- .buttonStyle(.plain).accessibilityLabel(L("结束会议"))- Text("正在听").font(.system(size: 13, weight: .semibold))- LevelMeter(model: model, bars: 8, height: 15, color: Palette.accent)- if let start = store.session(store.liveID)?.startedAt {- TimelineView(.periodic(from: .now, by: 1)) { ctx in- Text(TranscriptExport.clock(max(0, ctx.date.timeIntervalSince(start))))- .font(.system(size: 13).monospacedDigit())+ // Everything but 结束 brings back the notes (or the bar): closing them mid-meeting is+ // common, and this is the switch in front of you. Only 结束 ends the meeting.+ showButton {+ HStack(spacing: 10) {+ BreathingMark(size: 22)+ Text("正在听").font(.system(size: 13, weight: .semibold))+ LevelMeter(model: model, bars: 8, height: 15, color: Palette.accent)+ if let start = store.session(store.liveID)?.startedAt {+ TimelineView(.periodic(from: .now, by: 1)) { ctx in+ Text(TranscriptExport.clock(max(0, ctx.date.timeIntervalSince(start))))+ .font(.system(size: 13).monospacedDigit())+ }+ }}}Button { model.requestStop() } label: {@@ -124,26 +129,41 @@ struct ListenPill: View {.foregroundStyle(.white).padding(.leading, 5).padding(.trailing, 4).frame(height: 32).background(Capsule().fill(Palette.ink))- // The languages stay one hover away; the pill keeps to state, level and time.- .help(model.summary)+ }++ /// The pill's left part: shows what this meeting is on screen as. The languages stay one hover+ /// away, under what a click does; the pill itself keeps to state, level and time.+ private func showButton<Label: View>(@ViewBuilder _ label: () -> Label) -> some View {+ let action = model.settings.displayMode == "bar" ? L("显示字幕条") : L("显示实时纪要")+ return Button { model.showLiveDisplay() } label: {+ label().contentShape(Rectangle())+ }+ .buttonStyle(.plain)+ .linkPointer()+ .help(action + "\n" + model.summary)+ .accessibilityLabel(action)}private func ending(_ p: MeetingEndWatch.Pending) -> some View {TimelineView(.periodic(from: .now, by: 1)) { ctx inlet left = max(0, p.deadline.timeIntervalSince(ctx.date))HStack(spacing: 10) {- ZStack {- Circle().stroke(Color(red: 0.227, green: 0.239, blue: 0.27), lineWidth: 2.5)- Circle().trim(from: 0, to: min(1, left / endingTotal))- .stroke(Palette.accent, style: StrokeStyle(lineWidth: 2.5, lineCap: .round))- .rotationEffect(.degrees(-90))- BrandMark(size: 16)+ showButton {+ HStack(spacing: 10) {+ ZStack {+ Circle().stroke(Color(red: 0.227, green: 0.239, blue: 0.27), lineWidth: 2.5)+ Circle().trim(from: 0, to: min(1, left / endingTotal))+ .stroke(Palette.accent, style: StrokeStyle(lineWidth: 2.5, lineCap: .round))+ .rotationEffect(.degrees(-90))+ BrandMark(size: 16)+ }+ .frame(width: 26, height: 26)+ Text(model.endingTitle(p)).font(.system(size: 13, weight: .semibold)).lineLimit(1)+ Text(L("\(Int(left.rounded())) 秒后结束"))+ .font(.system(size: 13).monospacedDigit())+ .foregroundStyle(Color(red: 0.957, green: 0.647, blue: 0.549))+ }}- .frame(width: 26, height: 26)- Text(model.endingTitle(p)).font(.system(size: 13, weight: .semibold)).lineLimit(1)- Text(L("\(Int(left.rounded())) 秒后结束"))- .font(.system(size: 13).monospacedDigit())- .foregroundStyle(Color(red: 0.957, green: 0.647, blue: 0.549))Button { model.keepRecording() } label: {Text("继续记录").font(.system(size: 12, weight: .semibold)).foregroundStyle(Palette.ink).padding(.horizontal, 12).frame(height: 24)diff --git a/Sources/LiveSubs/Overlay.swift b/Sources/LiveSubs/Overlay.swiftindex ff1eb35..195e538 100644--- a/Sources/LiveSubs/Overlay.swift+++ b/Sources/LiveSubs/Overlay.swift@@ -218,6 +218,12 @@ final class OverlayController {}}+ /// The listening pill: back on screen however it went away (⌃⌥S, or tucked after a quiet spell).+ func reveal() {+ guard isShown else { show(); return }+ if manualHidden || !expanded { toggleManual() }+ }+func modeChanged() {if !mode().auto { lastContentAt = Date(); expand() }}