diff --git a/scripts/install_mac_app.sh b/scripts/install_mac_app.sh index 60460193..407f0191 100755 --- a/scripts/install_mac_app.sh +++ b/scripts/install_mac_app.sh @@ -96,7 +96,17 @@ cat > "${macos}/toastty-launch" < an # independent, non-bundle-associated process + window. -"${support_bin}" >/dev/null 2>&1 & +# +# Because this shim is a script (no Mach-O header), LaunchServices can't infer +# its architecture and on Apple Silicon may start it under Rosetta. A +# translated parent prefers the x86_64 slice of universal binaries, which +# leaks into the terminal's shell (\`uname -m\` => x86_64). Explicitly request +# the native slice on arm64 hardware. +if [ "\$(/usr/sbin/sysctl -n hw.optional.arm64 2>/dev/null)" = "1" ]; then + /usr/bin/arch -arm64 "${support_bin}" >/dev/null 2>&1 & +else + "${support_bin}" >/dev/null 2>&1 & +fi exit 0 LAUNCH chmod 0755 "${macos}/toastty-launch" @@ -113,6 +123,11 @@ cat > "${contents}/Info.plist" <CFBundleShortVersionString${version} CFBundleExecutable toastty-launch LSMultipleInstancesProhibited + LSArchitecturePriority + + arm64 + x86_64 + CFBundlePackageType APPL LSMinimumSystemVersion 11.0 NSHighResolutionCapable