chore: bundle mac app and custom menu icon

This commit is contained in:
Peter Steinberger
2025-12-05 23:54:15 +01:00
parent d0cefecd0d
commit b66098ea20
4 changed files with 97 additions and 25 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,5 @@ coverage
.pnpm-store
**/.DS_Store
apps/macos/.build/
apps/macos/Assets.xcassets/LobsterTemplate.imageset/lobster-template.pdf
bin/clawdis-mac
apps/macos/.build-local/

View File

@@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "lobster-template.pdf",
"idiom" : "mac",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@@ -3,6 +3,7 @@ import ApplicationServices
import AsyncXPCConnection
import ClawdisIPC
import Foundation
import class Foundation.Bundle
import OSLog
import CoreGraphics
@preconcurrency import ScreenCaptureKit
@@ -380,15 +381,51 @@ private struct LobsterStatusLabel: View {
var isPaused: Bool
var body: some View {
let imageView: Image = {
if let img = NSImage(named: "LobsterTemplate") {
img.isTemplate = true
return Image(nsImage: img).renderingMode(.template)
}
return Image(systemName: "antenna.radiowaves.left.and.right")
}()
LobsterGlyph()
.frame(width: 16, height: 16)
.foregroundStyle(isPaused ? .secondary : .primary)
}
}
return imageView.foregroundStyle(isPaused ? .secondary : .primary)
struct LobsterGlyph: View {
var body: some View {
GeometryReader { geo in
let w = geo.size.width
let h = geo.size.height
let midX = w / 2
let midY = h / 2
ZStack {
// Body
Capsule()
.frame(width: w * 0.4, height: h * 0.55)
.offset(y: h * 0.05)
// Claws
Capsule(style: .continuous)
.frame(width: w * 0.22, height: h * 0.28)
.rotationEffect(.degrees(-25))
.offset(x: -w * 0.32, y: -h * 0.05)
Capsule(style: .continuous)
.frame(width: w * 0.22, height: h * 0.28)
.rotationEffect(.degrees(25))
.offset(x: w * 0.32, y: -h * 0.05)
// Antennae
Path { p in
p.move(to: CGPoint(x: midX - w * 0.08, y: midY - h * 0.35))
p.addQuadCurve(to: CGPoint(x: midX - w * 0.18, y: midY - h * 0.6), control: CGPoint(x: midX - w * 0.2, y: midY - h * 0.45))
p.move(to: CGPoint(x: midX + w * 0.08, y: midY - h * 0.35))
p.addQuadCurve(to: CGPoint(x: midX + w * 0.18, y: midY - h * 0.6), control: CGPoint(x: midX + w * 0.2, y: midY - h * 0.45))
}
.stroke(lineWidth: 1.2)
// Tail segments
VStack(spacing: h * 0.04) {
Capsule().frame(width: w * 0.26, height: h * 0.12)
Capsule().frame(width: w * 0.22, height: h * 0.11)
Capsule().frame(width: w * 0.18, height: h * 0.1)
}
.offset(y: h * 0.18)
}
}
}
}

52
scripts/package-mac-app.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail
# Build and bundle Clawdis into a minimal .app we can open.
# Outputs to dist/Clawdis.app
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
APP_ROOT="$ROOT_DIR/dist/Clawdis.app"
BUILD_PATH="$ROOT_DIR/apps/macos/.build-local"
PRODUCT="Clawdis"
cd "$ROOT_DIR/apps/macos"
echo "🔨 Building $PRODUCT (debug)"
swift build -c debug --product "$PRODUCT" --build-path "$BUILD_PATH"
BIN="$BUILD_PATH/debug/$PRODUCT"
echo "🧹 Cleaning old app bundle"
rm -rf "$APP_ROOT"
mkdir -p "$APP_ROOT/Contents/MacOS"
mkdir -p "$APP_ROOT/Contents/Resources"
echo "📄 Writing Info.plist"
cat > "$APP_ROOT/Contents/Info.plist" <<'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.steipete.clawdis</string>
<key>CFBundleName</key>
<string>Clawdis</string>
<key>CFBundleExecutable</key>
<string>Clawdis</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSMinimumSystemVersion</key>
<string>15.0</string>
<key>LSUIElement</key>
<true/>
</dict>
</plist>
PLIST
echo "🚚 Copying binary"
cp "$BIN" "$APP_ROOT/Contents/MacOS/Clawdis"
chmod +x "$APP_ROOT/Contents/MacOS/Clawdis"
echo "✅ Bundle ready at $APP_ROOT"
echo "🚀 Launching app"
open "$APP_ROOT"