The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.
DMG: drag-to-install window modelled on Dia's; notarize.sh fails without credentials
Victor1ddf195d333a
diff --git a/resources/dmg/background.png b/resources/dmg/background.pngnew file mode 100644index 0000000..4821189Binary files /dev/null and b/resources/dmg/background.png differdiff --git a/resources/dmg/settings.py b/resources/dmg/settings.pynew file mode 100644index 0000000..de099db--- /dev/null+++ b/resources/dmg/settings.py@@ -0,0 +1,34 @@+# dmgbuild settings for Cra.dmg, run by scripts/package.sh:+# dmgbuild -s resources/dmg/settings.py -D app=build/Cra.app Cra build/dist/Cra.dmg+# The window mirrors Dia's installer: 800x400 pt, no chrome, 212 pt icons with the+# app on the left and Applications on the right of the chevron drawn into+# background.png (regenerate it with scripts/make-dmg-background.swift).+# Paths are relative to the repository root, where package.sh runs it.+import os.path++app = defines["app"] # noqa: F821 (injected by dmgbuild)++format = "UDZO"+filesystem = "HFS+"+files = [app]+symlinks = {"Applications": "/Applications"}+icon = "resources/AppIcon.icns"+background = "resources/dmg/background.png"++window_rect = ((110, 110), (800, 400))+default_view = "icon-view"+show_status_bar = False+show_tab_view = False+show_toolbar = False+show_pathbar = False+show_sidebar = False+show_icon_preview = False+show_item_info = False+arrange_by = None+label_pos = "bottom"+text_size = 16+icon_size = 212+icon_locations = {+ os.path.basename(app): (190, 180),+ "Applications": (610, 180),+}diff --git a/scripts/make-dmg-background.swift b/scripts/make-dmg-background.swiftnew file mode 100644index 0000000..a9c639c--- /dev/null+++ b/scripts/make-dmg-background.swift@@ -0,0 +1,84 @@+// Renders the DMG window background, resources/dmg/background.png: an 800x400 pt+// canvas at 2x (1600x800 px, 144 dpi) with the brand colours glowing in from the+// corners, the install line, and a chevron between the two icons.+// Layout must match resources/dmg/settings.py (icons centred at x 190 and 610).+// swift scripts/make-dmg-background.swift+import Cocoa++let W: CGFloat = 800, H: CGFloat = 400, scale: CGFloat = 2++extension NSColor {+ convenience init(hex: String, alpha: CGFloat = 1) {+ let v = Int(hex.dropFirst(), radix: 16)!+ self.init(srgbRed: CGFloat((v >> 16) & 0xff) / 255, green: CGFloat((v >> 8) & 0xff) / 255,+ blue: CGFloat(v & 0xff) / 255, alpha: alpha)+ }+}++let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: Int(W * scale), pixelsHigh: Int(H * scale),+ bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false,+ colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)!+rep.size = NSSize(width: W, height: H) // points, so the PNG is written at 144 dpi+NSGraphicsContext.saveGraphicsState()+NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: rep)+let cg = NSGraphicsContext.current!.cgContext++// Base: the same warm off-white Dia uses, so the white icon labels stay readable.+NSColor(hex: "#f7f7f6").setFill()+NSRect(x: 0, y: 0, width: W, height: H).fill()++// Glows: soft radial blooms, each brand colour from its corner of the logo+// (coral top left, blue top right, green bottom left, yellow bottom right).+// Coordinates are AppKit's, origin bottom left.+func glow(_ hex: String, at p: NSPoint, radius: CGFloat, alpha: CGFloat, squash: CGFloat = 1) {+ let c = NSColor(hex: hex)+ let g = NSGradient(colorsAndLocations: (c.withAlphaComponent(alpha), 0),+ (c.withAlphaComponent(alpha * 0.45), 0.45),+ (c.withAlphaComponent(0), 1))!+ cg.saveGState()+ cg.translateBy(x: p.x, y: p.y)+ cg.scaleBy(x: 1, y: squash)+ g.draw(fromCenter: .zero, radius: 0, toCenter: .zero, radius: radius, options: [])+ cg.restoreGState()+}+glow("#f0574f", at: NSPoint(x: -10, y: H + 10), radius: 230, alpha: 0.30, squash: 0.8)+glow("#3f6df5", at: NSPoint(x: W + 10, y: H + 10), radius: 230, alpha: 0.24, squash: 0.8)+glow("#4fbe7e", at: NSPoint(x: 40, y: -60), radius: 380, alpha: 0.36, squash: 0.55)+glow("#f6c34a", at: NSPoint(x: W - 40, y: -60), radius: 380, alpha: 0.44, squash: 0.55)+// A pale band along the bottom ties the two lower blooms together, as in Dia.+glow("#3f6df5", at: NSPoint(x: W / 2, y: -90), radius: 420, alpha: 0.14, squash: 0.4)++// Install line: "To install, drag Cra to Applications", names in bold.+let size: CGFloat = 17+let grey = NSColor(hex: "#1d1d1f", alpha: 0.6), ink = NSColor(hex: "#1d1d1f")+let regular = NSFont.systemFont(ofSize: size, weight: .regular)+let bold = NSFont.systemFont(ofSize: size, weight: .semibold)+let line = NSMutableAttributedString()+for (text, strong) in [("To install, drag ", false), ("Cra", true), (" to ", false), ("Applications", true)] {+ line.append(NSAttributedString(string: text, attributes: [+ .font: strong ? bold : regular, .foregroundColor: strong ? ink : grey, .kern: -0.1,+ ]))+}+let textSize = line.size()+line.draw(at: NSPoint(x: (W - textSize.width) / 2, y: H - 53 - textSize.height / 2))++// Chevrons: three, fading in toward Applications, centred between the icons.+let chevronY = H - 193, step: CGFloat = 16.5, half: CGFloat = 10+for (i, alpha) in [0.22, 0.5, 1.0].enumerated() {+ let x = W / 2 - step + CGFloat(i) * step+ let p = NSBezierPath()+ p.move(to: NSPoint(x: x - 4.5, y: chevronY + half))+ p.line(to: NSPoint(x: x + 4.5, y: chevronY))+ p.line(to: NSPoint(x: x - 4.5, y: chevronY - half))+ p.lineWidth = 3.4+ p.lineCapStyle = .round+ p.lineJoinStyle = .round+ ink.withAlphaComponent(alpha).setStroke()+ p.stroke()+}++NSGraphicsContext.restoreGraphicsState()+let out = URL(fileURLWithPath: CommandLine.arguments.dropFirst().first ?? "resources/dmg/background.png")+try FileManager.default.createDirectory(at: out.deletingLastPathComponent(), withIntermediateDirectories: true)+try rep.representation(using: .png, properties: [:])!.write(to: out)+print("Wrote \(out.path)")diff --git a/scripts/notarize.sh b/scripts/notarize.shindex bc57e1c..a4bfb8a 100755--- a/scripts/notarize.sh+++ b/scripts/notarize.sh@@ -13,8 +13,9 @@ if [ -n "${NOTARY_KEYCHAIN_PROFILE:-}" ]; thenelif [ -n "${APPLE_ID:-}" ] && [ -n "${APPLE_TEAM_ID:-}" ] && [ -n "${APPLE_APP_PASSWORD:-}" ]; thenAUTH=(--apple-id "$APPLE_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_APP_PASSWORD")else- echo "No notarization credentials in the environment; skipping." >&2- exit 0+ # Only called for Developer ID builds, and Gatekeeper rejects those unnotarized.+ echo "No notarization credentials in the environment. Set NOTARY_KEYCHAIN_PROFILE or APPLE_ID, APPLE_TEAM_ID and APPLE_APP_PASSWORD." >&2+ exit 1fiecho "Notarizing $(basename "$FILE")…"xcrun notarytool submit "$FILE" "${AUTH[@]}" --wait --timeout 30mdiff --git a/scripts/package.sh b/scripts/package.shindex 5e94cfb..d56ccda 100755--- a/scripts/package.sh+++ b/scripts/package.sh@@ -1,6 +1,6 @@#!/bin/bash-# Packages build/Cra.app into build/dist/: a zip, a DMG with an Applications-# shortcut, and SHA-256 checksums. Signs the DMG when CRA_SIGN_IDENTITY is set.+# Packages build/Cra.app into build/dist/: a zip, a DMG with the drag-to-install+# window (resources/dmg), and SHA-256 checksums. Signs the DMG when CRA_SIGN_IDENTITY is set.# scripts/package.sh [path/to/Cra.app]set -euo pipefailcd "$(dirname "$0")/.."@@ -17,12 +17,15 @@ DMG="$DIST/Cra.dmg"# Zip: ditto keeps resource forks and symlinks, which codesign requires.ditto -c -k --keepParent "$APP" "$ZIP"-# DMG: stage app + Applications link, build a compressed read-only image.-STAGE="$(mktemp -d /tmp/cra-dmg.XXXXXX)"-cp -R "$APP" "$STAGE/"-ln -s /Applications "$STAGE/Applications"-hdiutil create -quiet -volname "Cra" -srcfolder "$STAGE" -ov -format UDZO -fs HFS+ "$DMG"-rm -rf "$STAGE"+# DMG: dmgbuild writes the Finder layout (background, icon positions, hidden+# chrome) into .DS_Store directly, so no Finder scripting and it works on CI.+# Layout in resources/dmg/settings.py.+VENV="build/dmgbuild-venv"+if [ ! -x "$VENV/bin/dmgbuild" ]; then+ python3 -m venv "$VENV"+ "$VENV/bin/pip" install --quiet --disable-pip-version-check dmgbuild==1.6.7+fi+"$VENV/bin/dmgbuild" -s resources/dmg/settings.py -D app="$APP" "Cra" "$DMG"if [ "$IDENTITY" != "-" ]; thencodesign --force --sign "$IDENTITY" --timestamp "$DMG"fi