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
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Speak naturally. Keep your words on your own hardware.**

ClearFlow is an open-source macOS menu bar dictation app. Press **Option–Shift–Space**, speak, and press again to transcribe into the selected text field. Run **Whisper large-v3-turbo locally through MLX** on your own Apple Silicon Mac. You can also use another Mac you control, or explicitly configure your own Cloudflare Workers AI Nova 3 service.
ClearFlow is an open-source macOS dictation app with Dock and menu bar access. Press **Option–Shift–Space**, speak, and press again to transcribe into the selected text field. Run **Whisper large-v3-turbo locally through MLX** on your own Apple Silicon Mac. You can also use another Mac you control, or explicitly configure your own Cloudflare Workers AI Nova 3 service.

No account with ClearFlow, bundled hosted service, or automatic cloud fallback. Independent project; not affiliated with Wispr.

Expand All @@ -22,6 +22,12 @@ You need an **Apple Silicon Mac (M1 or newer), macOS 14+, Python 3.12**, and sev

Download `ClearFlow-macOS-arm64.zip` from [Releases](../../releases), extract it and move ClearFlow.app to Applications. Download the matching source archive, or clone this repository. Open a terminal in the source directory.

Open **Applications → ClearFlow**. To keep it in your Dock, right-click its Dock icon and choose **Options → Keep in Dock**. Clicking the Dock icon reopens the main window. Closing the window leaves the dictation shortcut running; use **ClearFlow → Quit ClearFlow** (Command–Q) to quit.

![ClearFlow app icon](assets/AppIcon.png)

[Editable icon source and reproduction instructions](assets/README.md).

Alternatively, build it yourself:

```sh
Expand Down
30 changes: 29 additions & 1 deletion Sources/ClearFlow/ClearFlowApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ import ClearFlowCore
private var startItem: NSMenuItem!
private var statusMenuItem: NSMenuItem!
func applicationDidFinishLaunching(_ notification: Notification) {
NSApp.setActivationPolicy(.accessory)
NSApp.setActivationPolicy(.regular)
installMainMenu()
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
statusItem.button?.image = NSImage(systemSymbolName: "waveform", accessibilityDescription: "ClearFlow")
let menu = NSMenu()
Expand Down Expand Up @@ -104,6 +105,33 @@ import ClearFlowCore
overlay.orderFrontRegardless()
} else { overlay.orderOut(nil) }
}
// Opening from Finder or the Dock should restore the controls, even after closing them.
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
showWindow()
return true
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { false }
private func installMainMenu() {
let main = NSMenu()
let appItem = NSMenuItem()
let appMenu = NSMenu(title: "ClearFlow")
appMenu.addItem(withTitle: "Hide ClearFlow", action: #selector(NSApplication.hide(_:)), keyEquivalent: "h")
appMenu.addItem(.separator())
let quitItem = appMenu.addItem(withTitle: "Quit ClearFlow", action: #selector(quit), keyEquivalent: "q")
quitItem.target = self
appItem.submenu = appMenu
main.addItem(appItem)
let editItem = NSMenuItem()
let edit = NSMenu(title: "Edit")
for (title, action, key) in [("Undo", "undo:", "z"), ("Redo", "redo:", "Z"),
("Cut", "cut:", "x"), ("Copy", "copy:", "c"),
("Paste", "paste:", "v"), ("Select All", "selectAll:", "a")] {
edit.addItem(withTitle: title, action: Selector(action), keyEquivalent: key)
}
editItem.submenu = edit
main.addItem(editItem)
NSApp.mainMenu = main
}
@objc func toggle() { model.toggle() }
@objc func showWindow() {
if window == nil {
Expand Down
Binary file added assets/AppIcon.icns
Binary file not shown.
Binary file added assets/AppIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ClearFlow app icon

The original seven-bar ClearFlow waveform uses a white mark on a dark plum rounded tile, with transparent macOS icon margins. It follows the app's existing waveform identity. No third-party artwork is included.

- `AppIcon.icns`: Finder, Dock and application-switcher icon, bundled by `scripts/build-app.sh`.
- `AppIcon.png`: 1024-pixel transparent preview/export.
- `../scripts/render-app-icon.swift`: editable native drawing source, under the repository MIT license.

Rebuild all icon resolutions on macOS with Command Line Tools installed:

```sh
scripts/generate-icon.sh
scripts/build-app.sh
```

The ICNS contains 16, 32, 64, 128, 256, 512 and 1024-pixel images. Builds use the committed icon, so routine app compilation does not require regeneration.
3 changes: 2 additions & 1 deletion scripts/build-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ APP="$PWD/dist/ClearFlow.app"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp "$(swift build -c release --arch arm64 --show-bin-path)/ClearFlow" "$APP/Contents/MacOS/ClearFlow"
cp assets/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
python3 - "$APP" "http://127.0.0.1:8768" <<'PY'
import pathlib,plistlib,sys
app=pathlib.Path(sys.argv[1])
info={"CFBundleName":"ClearFlow","CFBundleDisplayName":"ClearFlow","CFBundleIdentifier":"org.clearflow.app","CFBundleExecutable":"ClearFlow","CFBundlePackageType":"APPL","CFBundleShortVersionString":"0.4.3","CFBundleVersion":"11","LSMinimumSystemVersion":"14.0","LSUIElement":True,"NSHighResolutionCapable":True,"NSMicrophoneUsageDescription":"ClearFlow records your voice only when you start dictation, then sends it to the transcription service you configure.","ClearFlowEndpoint":sys.argv[2]}
info={"CFBundleName":"ClearFlow","CFBundleDisplayName":"ClearFlow","CFBundleIdentifier":"org.clearflow.app","CFBundleExecutable":"ClearFlow","CFBundlePackageType":"APPL","CFBundleShortVersionString":"0.4.4","CFBundleVersion":"12","LSMinimumSystemVersion":"14.0","LSUIElement":False,"CFBundleIconFile":"AppIcon","NSHighResolutionCapable":True,"NSMicrophoneUsageDescription":"ClearFlow records your voice only when you start dictation, then sends it to the transcription service you configure.","ClearFlowEndpoint":sys.argv[2]}
(app/"Contents/Info.plist").write_bytes(plistlib.dumps(info))
PY
# Remove linker debug records containing the build machine absolute source paths.
Expand Down
9 changes: 8 additions & 1 deletion scripts/check-distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@
errors.append("Release endpoint must be loopback")
if info.get("CFBundleIdentifier") != "org.clearflow.app":
errors.append("Release bundle identifier must be generic")
if info.get("LSUIElement") is not False:
errors.append("Release must be a Dock-visible application")
if info.get("CFBundleIconFile") != "AppIcon":
errors.append("Release must declare its app icon")
icon = info_path.parent / "Resources/AppIcon.icns"
if not icon.exists() or not icon.read_bytes().startswith(b"icns"):
errors.append("Release must include a valid ICNS icon")
bundle = info_path.parent.parent
allowed = {"Contents/Info.plist", "Contents/MacOS/ClearFlow", "Contents/_CodeSignature/CodeResources"}
allowed = {"Contents/Info.plist", "Contents/Resources/AppIcon.icns", "Contents/MacOS/ClearFlow", "Contents/_CodeSignature/CodeResources"}
for path in bundle.rglob("*"):
if path.is_file():
relative = path.relative_to(bundle).as_posix()
Expand Down
14 changes: 14 additions & 0 deletions scripts/generate-icon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
mkdir -p assets
icon_work="$(mktemp -d)"
trap 'rm -rf "$icon_work"' EXIT
mkdir "$icon_work/AppIcon.iconset"
swiftc scripts/render-app-icon.swift -o "$icon_work/render"
for size in 16 32 128 256 512; do
"$icon_work/render" "$icon_work/AppIcon.iconset/icon_${size}x${size}.png" "$size"
"$icon_work/render" "$icon_work/AppIcon.iconset/icon_${size}x${size}@2x.png" "$((size * 2))"
done
cp "$icon_work/AppIcon.iconset/[email protected]" assets/AppIcon.png
iconutil -c icns "$icon_work/AppIcon.iconset" -o assets/AppIcon.icns
36 changes: 36 additions & 0 deletions scripts/render-app-icon.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import AppKit

// Original ClearFlow waveform, drawn directly at every icon resolution.
// Coordinates use a 1024-point canvas with standard transparent macOS icon margins.
let destination = CommandLine.arguments[1]
let pixels = Int(CommandLine.arguments[2])!
let bitmap = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: pixels, pixelsHigh: pixels,
bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true,
isPlanar: false, colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)!
NSGraphicsContext.saveGraphicsState()
let context = NSGraphicsContext(bitmapImageRep: bitmap)!
NSGraphicsContext.current = context
context.cgContext.scaleBy(x: CGFloat(pixels) / 1024, y: CGFloat(pixels) / 1024)
let tile = NSBezierPath(roundedRect: NSRect(x: 100, y: 100, width: 824, height: 824), xRadius: 184, yRadius: 184)
NSGraphicsContext.saveGraphicsState()
let shadow = NSShadow()
shadow.shadowColor = NSColor.black.withAlphaComponent(0.20)
shadow.shadowBlurRadius = 15
shadow.shadowOffset = NSSize(width: 0, height: -8)
shadow.set()
NSColor(calibratedRed: 0.10, green: 0.085, blue: 0.13, alpha: 1).setFill()
tile.fill()
NSGraphicsContext.restoreGraphicsState()
NSGradient(starting: NSColor(calibratedRed: 0.10, green: 0.085, blue: 0.13, alpha: 1),
ending: NSColor(calibratedRed: 0.23, green: 0.205, blue: 0.29, alpha: 1))!.draw(in: tile, angle: 90)
NSColor.white.withAlphaComponent(0.12).setStroke()
tile.lineWidth = 2
tile.stroke()
NSColor(calibratedWhite: 0.975, alpha: 1).setFill()
let heights: [CGFloat] = [112, 230, 352, 488, 352, 230, 112]
for (index, height) in heights.enumerated() {
let bar = NSRect(x: 253 + CGFloat(index) * 78, y: 512 - height / 2, width: 50, height: height)
NSBezierPath(roundedRect: bar, xRadius: 25, yRadius: 25).fill()
}
NSGraphicsContext.restoreGraphicsState()
try bitmap.representation(using: .png, properties: [:])!.write(to: URL(fileURLWithPath: destination))
Loading