Skip to content

Commit 9f05804

Browse files
committed
chore: add logo
1 parent 24696bd commit 9f05804

File tree

6 files changed

+89
-20
lines changed

6 files changed

+89
-20
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ jobs:
2626
uses: actions/upload-artifact@v4
2727
with:
2828
name: OpenWispr-${{ github.ref_name }}
29-
path: dist/*
29+
path: |
30+
dist/*.dmg
31+
dist/*.dmg.sha256
3032
3133
- name: Publish GitHub release
3234
uses: softprops/action-gh-release@v2
3335
with:
3436
tag_name: ${{ github.ref_name }}
3537
generate_release_notes: true
3638
files: |
37-
dist/*.zip
38-
dist/*.sha256
39+
dist/*.dmg
40+
dist/*.dmg.sha256

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ For local STT, point `Local Model Path` to a valid Whisper model file, for examp
5858

5959
## Packaging
6060

61-
Create an unsigned `.app` zip locally:
61+
Create an unsigned drag-and-drop `.dmg` locally:
6262

6363
```bash
6464
./scripts/package-release.sh v0.1.0
6565
```
6666

6767
Artifacts are written to `dist/`:
6868

69-
- `OpenWispr-<tag>-macos-<arch>.zip`
70-
- `OpenWispr-<tag>-macos-<arch>.zip.sha256`
69+
- `OpenWispr-<tag>-macos-<arch>.dmg`
70+
- `OpenWispr-<tag>-macos-<arch>.dmg.sha256`
71+
72+
The app icon is generated from `openwispr.png` during packaging.
7173

7274
This package is intentionally unsigned for now.
7375

@@ -77,7 +79,7 @@ Pushing any git tag triggers `.github/workflows/release.yml`, which will:
7779

7880
- build the release package
7981
- upload it as a workflow artifact
80-
- create/update a GitHub Release for that tag with the zip + checksum attached
82+
- create/update a GitHub Release for that tag with the dmg + checksum attached
8183

8284
## Tests and Linting
8385

Sources/OpenWisprMac/AppState.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ final class AppState: ObservableObject {
7777
return false
7878
}
7979

80+
var lastTranscriptPreview: String {
81+
let collapsed =
82+
lastTranscript
83+
.replacingOccurrences(of: "\\s+", with: " ", options: .regularExpression)
84+
.trimmingCharacters(in: .whitespacesAndNewlines)
85+
86+
let maxLength = 220
87+
guard collapsed.count > maxLength else {
88+
return collapsed
89+
}
90+
91+
let endIndex = collapsed.index(collapsed.startIndex, offsetBy: maxLength)
92+
return String(collapsed[..<endIndex]) + "..."
93+
}
94+
8095
var startAtLoginSupported: Bool {
8196
startAtLogin.isSupported
8297
}

Sources/OpenWisprMac/OpenWisprMacApp.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,32 @@ struct MenuBarContentView: View {
2626
.disabled(appState.isProcessing)
2727

2828
if !appState.lastTranscript.isEmpty {
29-
Text("Last transcript")
29+
HStack {
30+
Text("Last transcript")
31+
.font(.caption)
32+
.foregroundStyle(.secondary)
33+
34+
Spacer()
35+
36+
Button("Copy") {
37+
PasteInjector.copyToClipboard(appState.lastTranscript)
38+
}
39+
.buttonStyle(.plain)
3040
.font(.caption)
31-
.foregroundStyle(.secondary)
41+
}
3242

33-
Text(appState.lastTranscript)
34-
.lineLimit(4)
43+
Text(appState.lastTranscriptPreview)
44+
.lineLimit(3)
45+
.truncationMode(.tail)
46+
.fixedSize(horizontal: false, vertical: true)
3547
.textSelection(.enabled)
3648
.font(.system(size: 12))
49+
50+
if appState.lastTranscriptPreview != appState.lastTranscript {
51+
Text("Preview truncated")
52+
.font(.caption2)
53+
.foregroundStyle(.secondary)
54+
}
3755
}
3856

3957
if !appState.lastError.isEmpty {

openwispr.png

44.3 KB
Loading

scripts/package-release.sh

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ ARCH="$(uname -m)"
88
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
99
DIST_DIR="$ROOT_DIR/dist"
1010
APP_BUNDLE_PATH="$DIST_DIR/${APP_NAME}.app"
11-
ZIP_NAME="${APP_NAME}-${TAG}-macos-${ARCH}.zip"
12-
ZIP_PATH="$DIST_DIR/$ZIP_NAME"
11+
DMG_NAME="${APP_NAME}-${TAG}-macos-${ARCH}.dmg"
12+
DMG_PATH="$DIST_DIR/$DMG_NAME"
13+
DMG_STAGING_DIR="$DIST_DIR/.dmg-staging"
14+
ICON_SOURCE="$ROOT_DIR/openwispr.png"
15+
ICONSET_DIR="$DIST_DIR/.AppIcon.iconset"
16+
ICON_FILE_NAME="AppIcon.icns"
17+
CHECKSUM_PATH="$DMG_PATH.sha256"
1318

1419
BUNDLE_VERSION="${TAG#v}"
1520
if [[ ! "$BUNDLE_VERSION" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
@@ -25,13 +30,31 @@ if [[ ! -x "$BIN_PATH" ]]; then
2530
exit 1
2631
fi
2732

33+
if [[ ! -f "$ICON_SOURCE" ]]; then
34+
echo "missing icon source: $ICON_SOURCE" >&2
35+
exit 1
36+
fi
37+
2838
echo "[package] creating app bundle"
2939
rm -rf "$APP_BUNDLE_PATH"
30-
mkdir -p "$APP_BUNDLE_PATH/Contents/MacOS"
40+
mkdir -p "$APP_BUNDLE_PATH/Contents/MacOS" "$APP_BUNDLE_PATH/Contents/Resources"
3141

3242
cp "$BIN_PATH" "$APP_BUNDLE_PATH/Contents/MacOS/$APP_NAME"
3343
chmod +x "$APP_BUNDLE_PATH/Contents/MacOS/$APP_NAME"
3444

45+
echo "[package] generating app icon"
46+
rm -rf "$ICONSET_DIR"
47+
mkdir -p "$ICONSET_DIR"
48+
49+
for size in 16 32 128 256 512; do
50+
sips -s format png -z "$size" "$size" "$ICON_SOURCE" --out "$ICONSET_DIR/icon_${size}x${size}.png" >/dev/null
51+
doubled_size="$((size * 2))"
52+
sips -s format png -z "$doubled_size" "$doubled_size" "$ICON_SOURCE" --out "$ICONSET_DIR/icon_${size}x${size}@2x.png" >/dev/null
53+
done
54+
55+
iconutil -c icns "$ICONSET_DIR" -o "$APP_BUNDLE_PATH/Contents/Resources/$ICON_FILE_NAME"
56+
rm -rf "$ICONSET_DIR"
57+
3558
cat > "$APP_BUNDLE_PATH/Contents/Info.plist" <<EOF
3659
<?xml version="1.0" encoding="UTF-8"?>
3760
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -45,6 +68,8 @@ cat > "$APP_BUNDLE_PATH/Contents/Info.plist" <<EOF
4568
<string>OpenWispr</string>
4669
<key>CFBundleIdentifier</key>
4770
<string>io.github.tnfssc.openwispr</string>
71+
<key>CFBundleIconFile</key>
72+
<string>AppIcon</string>
4873
<key>CFBundlePackageType</key>
4974
<string>APPL</string>
5075
<key>CFBundleShortVersionString</key>
@@ -61,12 +86,19 @@ cat > "$APP_BUNDLE_PATH/Contents/Info.plist" <<EOF
6186
</plist>
6287
EOF
6388

64-
echo "[package] zipping app bundle"
89+
echo "[package] building dmg"
6590
mkdir -p "$DIST_DIR"
66-
rm -f "$ZIP_PATH" "$ZIP_PATH.sha256"
67-
ditto -c -k --sequesterRsrc --keepParent "$APP_BUNDLE_PATH" "$ZIP_PATH"
68-
shasum -a 256 "$ZIP_PATH" > "$ZIP_PATH.sha256"
91+
rm -rf "$DMG_STAGING_DIR"
92+
mkdir -p "$DMG_STAGING_DIR"
93+
94+
cp -R "$APP_BUNDLE_PATH" "$DMG_STAGING_DIR/"
95+
ln -s /Applications "$DMG_STAGING_DIR/Applications"
96+
97+
rm -f "$DMG_PATH" "$CHECKSUM_PATH"
98+
hdiutil create -volname "$APP_NAME" -srcfolder "$DMG_STAGING_DIR" -ov -format UDZO "$DMG_PATH" >/dev/null
99+
shasum -a 256 "$DMG_PATH" > "$CHECKSUM_PATH"
100+
rm -rf "$DMG_STAGING_DIR"
69101

70102
echo "[package] created artifact"
71-
echo " $ZIP_PATH"
72-
echo " $ZIP_PATH.sha256"
103+
echo " $DMG_PATH"
104+
echo " $CHECKSUM_PATH"

0 commit comments

Comments
 (0)