Skip to content

Commit 7849527

Browse files
committed
feat: add app icon and improve build process
1. Add icon generation script 2. Update Info.plist with proper icon configuration 3. Improve build script with better error handling 4. Clean up temporary files
1 parent b589538 commit 7849527

File tree

9 files changed

+106
-9
lines changed

9 files changed

+106
-9
lines changed

AppIcon.icns

-132 KB
Binary file not shown.

BTCWatcher.app/Contents/Info.plist

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CFBundleExecutable</key>
6+
<string>BTCWatcher</string>
57
<key>CFBundleIdentifier</key>
6-
<string>com.example.BTCMenuBar</string>
8+
<string>com.chenwuai.btcwatcher</string>
79
<key>CFBundleName</key>
8-
<string>BTCMenuBar</string>
10+
<string>BTCWatcher</string>
11+
<key>CFBundleDisplayName</key>
12+
<string>BTCWatcher</string>
13+
<key>CFBundleIconFile</key>
14+
<string>AppIcon</string>
915
<key>CFBundlePackageType</key>
1016
<string>APPL</string>
1117
<key>CFBundleShortVersionString</key>
12-
<string>1.0</string>
18+
<string>1.0.0</string>
1319
<key>CFBundleVersion</key>
1420
<string>1</string>
1521
<key>LSMinimumSystemVersion</key>
17.7 KB
Binary file not shown.
80.4 KB
Binary file not shown.

BTCWatcher.app/Contents/_CodeSignature/CodeResources

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,22 @@
33
<plist version="1.0">
44
<dict>
55
<key>files</key>
6-
<dict/>
6+
<dict>
7+
<key>Resources/AppIcon.icns</key>
8+
<data>
9+
6NQirc6TE6UsbxQtiZM+3YbOmCY=
10+
</data>
11+
</dict>
712
<key>files2</key>
8-
<dict/>
13+
<dict>
14+
<key>Resources/AppIcon.icns</key>
15+
<dict>
16+
<key>hash2</key>
17+
<data>
18+
hNq21BNIsTKkRPK2uK6GWcvXxiBuw4apwDa1RirdSvc=
19+
</data>
20+
</dict>
21+
</dict>
922
<key>rules</key>
1023
<dict>
1124
<key>^Resources/</key>

Info.plist

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CFBundleExecutable</key>
6+
<string>BTCWatcher</string>
57
<key>CFBundleIdentifier</key>
6-
<string>com.example.BTCMenuBar</string>
8+
<string>com.chenwuai.btcwatcher</string>
79
<key>CFBundleName</key>
8-
<string>BTCMenuBar</string>
10+
<string>BTCWatcher</string>
11+
<key>CFBundleDisplayName</key>
12+
<string>BTCWatcher</string>
13+
<key>CFBundleIconFile</key>
14+
<string>AppIcon</string>
915
<key>CFBundlePackageType</key>
1016
<string>APPL</string>
1117
<key>CFBundleShortVersionString</key>
12-
<string>1.0</string>
18+
<string>1.0.0</string>
1319
<key>CFBundleVersion</key>
1420
<string>1</string>
1521
<key>LSMinimumSystemVersion</key>

Resources/AppIcon.icns

212 KB
Binary file not shown.

build.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ if [ -d "Resources" ]; then
3939
cp -r Resources/* "$APP_BUNDLE/Contents/Resources/"
4040
fi
4141

42+
# Remove extended attributes
43+
echo "🧹 Removing extended attributes..."
44+
xattr -cr "$APP_BUNDLE"
45+
46+
# Sign the application
47+
echo "📝 Signing application..."
48+
codesign --force --deep --sign - "$APP_BUNDLE"
49+
4250
# Create zip archive using ditto (preserves permissions and attributes)
4351
echo "📦 Creating zip archive..."
4452
ditto -c -k --keepParent "$APP_BUNDLE" "$ZIP_NAME"
@@ -50,7 +58,10 @@ if [ $? -eq 0 ]; then
5058
echo " or"
5159
echo "2. Run: open $APP_BUNDLE"
5260
echo ""
53-
echo "Note: Do not run the executable directly. Always use the app bundle."
61+
echo "If you see 'app is damaged' message:"
62+
echo "1. Right-click the app and select 'Open'"
63+
echo "2. Click 'Open' in the security dialog"
64+
echo "3. The app will be saved as an exception"
5465
else
5566
echo "❌ Failed to create zip archive!"
5667
exit 1

makeicon.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
# Check if rsvg-convert is installed
4+
if ! command -v rsvg-convert &> /dev/null; then
5+
echo "Installing rsvg-convert..."
6+
brew install librsvg
7+
fi
8+
9+
# Convert SVG to PNG
10+
if [ -f "AppIcon.svg" ]; then
11+
echo "🎨 Converting SVG to PNG..."
12+
rsvg-convert -w 1024 -h 1024 AppIcon.svg > icon.png
13+
fi
14+
15+
# Create temporary iconset directory
16+
ICONSET="AppIcon.iconset"
17+
mkdir -p "$ICONSET"
18+
19+
# Function to create icon from base image
20+
create_icon() {
21+
local size=$1
22+
local input=$2
23+
local output="$ICONSET/icon_${size}x${size}.png"
24+
sips -z $size $size "$input" --out "$output"
25+
}
26+
27+
# Check if input image exists
28+
if [ ! -f "icon.png" ]; then
29+
echo "❌ Error: icon.png not found!"
30+
echo "Please provide a square PNG image named 'icon.png'"
31+
exit 1
32+
fi
33+
34+
# Create icons of different sizes
35+
create_icon 16 "icon.png"
36+
create_icon 32 "icon.png"
37+
create_icon 64 "icon.png"
38+
create_icon 128 "icon.png"
39+
create_icon 256 "icon.png"
40+
create_icon 512 "icon.png"
41+
create_icon 1024 "icon.png"
42+
43+
# Copy for @2x versions
44+
cp "$ICONSET/icon_32x32.png" "$ICONSET/icon_16x16@2x.png"
45+
cp "$ICONSET/icon_64x64.png" "$ICONSET/icon_32x32@2x.png"
46+
cp "$ICONSET/icon_256x256.png" "$ICONSET/icon_128x128@2x.png"
47+
cp "$ICONSET/icon_512x512.png" "$ICONSET/icon_256x256@2x.png"
48+
cp "$ICONSET/icon_1024x1024.png" "$ICONSET/icon_512x512@2x.png"
49+
50+
# Create icns file
51+
iconutil -c icns "$ICONSET"
52+
53+
# Move to Resources
54+
mkdir -p Resources
55+
mv AppIcon.icns Resources/
56+
57+
# Clean up
58+
rm -rf "$ICONSET"
59+
rm -f icon.png
60+
61+
echo "✅ Icon created successfully!"

0 commit comments

Comments
 (0)