Skip to content

Commit 8220ec2

Browse files
committed
glass icon compilation
1 parent 29ca538 commit 8220ec2

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ Output will be in:
5656
pnpm build-native
5757
```
5858

59+
### Liquid Glass Icon (macOS 26+)
60+
61+
The app supports macOS liquid glass icons for a modern, layered appearance. The icon configuration is in `build/icon.icon/`.
62+
63+
**Compiling the liquid glass icon requires Xcode** (Command Line Tools are not sufficient):
64+
65+
```bash
66+
# Compile liquid glass icon (requires Xcode)
67+
bash scripts/compile-glass-icon.sh
68+
```
69+
70+
If you don't have Xcode installed, the build will automatically fall back to the standard `.icns` icon. To enable liquid glass icons:
71+
72+
1. Install Xcode from the App Store
73+
2. Run the compile script above, or
74+
3. Compile `Assets.car` on a machine with Xcode and commit it to the repo
75+
76+
The `generateAssets` hook will automatically attempt to compile the icon during packaging if Xcode is available.
77+
5978
### Environment Variables
6079

6180
You can set these environment variables instead of entering credentials in the app:

build/Assets.car

5.32 MB
Binary file not shown.

build/icon.icon/Assets/logo.png

1.2 MB
Loading

build/icon.icon/icon.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"fill" : {
3+
"solid" : "srgb:0.96078,0.41961,0.08235,1.00000"
4+
},
5+
"groups" : [
6+
{
7+
"blur-material" : null,
8+
"layers" : [
9+
{
10+
"blend-mode" : "normal",
11+
"fill" : "automatic",
12+
"glass" : true,
13+
"hidden" : false,
14+
"image-name" : "logo.png",
15+
"name" : "logo",
16+
"position" : {
17+
"scale" : 1.18,
18+
"translation-in-points" : [
19+
0,
20+
0
21+
]
22+
}
23+
}
24+
],
25+
"lighting" : "individual",
26+
"shadow" : {
27+
"kind" : "neutral",
28+
"opacity" : 0.5
29+
},
30+
"specular" : true,
31+
"translucency" : {
32+
"enabled" : true,
33+
"value" : 0.5
34+
}
35+
}
36+
],
37+
"supported-platforms" : {
38+
"circles" : [
39+
"watchOS"
40+
],
41+
"squares" : "shared"
42+
}
43+
}

forge.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ const config: ForgeConfig = {
1111
name: "Array",
1212
executableName: "Array",
1313
icon: "./build/app-icon", // Forge adds .icns/.ico/.png based on platform
14+
extraResource: existsSync("build/Assets.car") ? ["build/Assets.car"] : [],
15+
extendInfo: existsSync("build/Assets.car")
16+
? {
17+
CFBundleIconName: "Icon",
18+
}
19+
: {},
1420
},
1521
rebuildConfig: {},
1622
makers: [
@@ -21,6 +27,13 @@ const config: ForgeConfig = {
2127
new MakerZIP({}, ["darwin", "linux", "win32"]),
2228
],
2329
hooks: {
30+
generateAssets: async () => {
31+
// Compile liquid glass icon to Assets.car
32+
if (existsSync("build/icon.icon")) {
33+
console.log("Compiling liquid glass icon...");
34+
execSync("bash scripts/compile-glass-icon.sh", { stdio: "inherit" });
35+
}
36+
},
2437
prePackage: async () => {
2538
// Build native modules for DMG maker on Node.js 22
2639
const modules = ["macos-alias", "fs-xattr"];

scripts/compile-glass-icon.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
3+
# Compile liquid glass icon to Assets.car
4+
# Based on: https://www.hendrik-erz.de/post/supporting-liquid-glass-icons-in-apps-without-xcode
5+
#
6+
# NOTE: This requires Xcode to be installed (Command Line Tools are not sufficient)
7+
# If you don't have Xcode, you can either:
8+
# 1. Install Xcode from the App Store
9+
# 2. Manually compile Assets.car on a machine with Xcode and commit it
10+
# 3. Skip liquid glass icon support (the app will use the regular .icns icon)
11+
12+
set -e
13+
14+
ICON_PATH="build/icon.icon"
15+
OUTPUT_PATH="build/Assets.car"
16+
TEMP_DIR=$(mktemp -d)
17+
18+
if [ ! -d "$ICON_PATH" ]; then
19+
echo "$ICON_PATH not found - skipping liquid glass icon compilation"
20+
exit 0
21+
fi
22+
23+
# Check if Assets.car exists and is newer than source
24+
if [ -f "$OUTPUT_PATH" ] && [ "$OUTPUT_PATH" -nt "$ICON_PATH/icon.json" ]; then
25+
echo "✓ Assets.car is up to date"
26+
exit 0
27+
fi
28+
29+
echo "Compiling liquid glass icon..."
30+
31+
# Check if actool is available and functional
32+
if ! command -v actool &> /dev/null; then
33+
echo "⚠ actool not found - Xcode is required to compile liquid glass icons"
34+
echo " Skipping compilation (app will use standard .icns icon)"
35+
exit 0
36+
fi
37+
38+
# Try to compile with actool
39+
PARTIAL_INFO_PLIST="$TEMP_DIR/partial-info.plist"
40+
41+
if ! actool "$ICON_PATH" \
42+
--compile "$TEMP_DIR" \
43+
--output-format human-readable-text \
44+
--notices --warnings --errors \
45+
--output-partial-info-plist "$PARTIAL_INFO_PLIST" \
46+
--app-icon Icon \
47+
--include-all-app-icons \
48+
--enable-on-demand-resources NO \
49+
--development-region en \
50+
--target-device mac \
51+
--minimum-deployment-target 26.0 \
52+
--platform macosx 2>&1; then
53+
echo "⚠ actool failed - Xcode is required to compile liquid glass icons"
54+
echo " Skipping compilation (app will use standard .icns icon)"
55+
rm -rf "$TEMP_DIR"
56+
exit 0
57+
fi
58+
59+
# Move Assets.car to build directory
60+
if [ -f "$TEMP_DIR/Assets.car" ]; then
61+
mv "$TEMP_DIR/Assets.car" "$OUTPUT_PATH"
62+
echo "✓ Compiled Assets.car to $OUTPUT_PATH"
63+
else
64+
echo "⚠ Assets.car not generated - skipping"
65+
fi
66+
67+
# Clean up
68+
rm -rf "$TEMP_DIR"

0 commit comments

Comments
 (0)