知了 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
import AppKit
@MainActor
enum DockIcon {
private(set) static var live = false
static func show(live: Bool) {
self.live = live
let tile = NSApp.dockTile
let view = NSImageView(frame: NSRect(origin: .zero, size: tile.size))
view.image = image(live: live)
view.imageScaling = .scaleProportionallyUpOrDown
tile.contentView = view
tile.display()
}
private static func image(live: Bool) -> NSImage {
let icon = NSWorkspace.shared.icon(forFile: Bundle.main.bundlePath)
let size = NSSize(width: 256, height: 256)
return NSImage(size: size, flipped: false) { rect in
icon.draw(in: rect)
guard live else { return true }
let d = rect.width * 0.22
let dot = NSRect(x: rect.maxX - rect.width * 0.1 - d * 0.8, y: rect.maxY - rect.height * 0.1 - d * 0.8,
width: d, height: d)
NSColor.white.setFill()
NSBezierPath(ovalIn: dot.insetBy(dx: -d * 0.1, dy: -d * 0.1)).fill()
NSColor(srgbRed: 0.91, green: 0.33, blue: 0.17, alpha: 1).setFill()
NSBezierPath(ovalIn: dot).fill()
return true
}
}
}