Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@ jobs:
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>$VERSION</string>
<key>CFBundleVersion</key><string>$VERSION</string>
<key>CFBundleIconFile</key><string>AppIcon</string>
<key>LSMinimumSystemVersion</key><string>13.0</string>
<key>LSUIElement</key><true/>
<key>NSHighResolutionCapable</key><true/>
</dict>
</plist>
PLIST

# Rasterize the vector brand mark at every required size (NSImage renders the SVG as
# vector, not a blown-up 16px bitmap) and pack it into a proper multi-resolution .icns.
swift Scripts/generate-icon.swift \
NotchWatch/Resources/Images/notchwatch-corbeau-16-modified.svg \
AppIcon.iconset
iconutil -c icns AppIcon.iconset -o "$APP/Contents/Resources/AppIcon.icns"

# No Apple Developer ID available: ad-hoc sign only. Users get a Gatekeeper
# warning on first launch (documented in README) — not notarized.
codesign --force --deep --sign - "$APP"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@

```sh
brew tap Lixeas/notchwatch https://github.com/Lixeas/NotchWatch
brew trust --cask lixeas/notchwatch/notch-watch
brew install --cask notch-watch
```

This installs the latest signed `.dmg` from [GitHub Releases](https://github.com/Lixeas/NotchWatch/releases) and keeps a Homebrew-managed `NotchWatch.app` in `/Applications`. To update: `brew upgrade --cask notch-watch`.
Homebrew 6.0+ requires explicit trust for non-official taps (`brew trust`) — one-time, before the first install. This installs the latest signed `.dmg` from [GitHub Releases](https://github.com/Lixeas/NotchWatch/releases) and keeps a Homebrew-managed `NotchWatch.app` in `/Applications`. To update: `brew upgrade --cask notch-watch`.

### Option 2 — Manual download

Expand Down
48 changes: 48 additions & 0 deletions Scripts/generate-icon.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import AppKit

// Standalone build-time script (run via `swift Scripts/generate-icon.swift <source.svg> <output.iconset>`
// on the macOS release runner) -- not part of the app target, iconutil needs a populated
// .iconset directory of PNGs at each required size, generated here from the vector SVG source.

let arguments = CommandLine.arguments
guard arguments.count == 3 else {
FileHandle.standardError.write(Data("Usage: generate-icon.swift <source.svg> <output.iconset>\n".utf8))
exit(1)
}
let sourcePath = arguments[1]
let outputDir = arguments[2]

guard let source = NSImage(contentsOfFile: sourcePath) else {
FileHandle.standardError.write(Data("Failed to load \(sourcePath)\n".utf8))
exit(1)
}

let sizes: [(name: String, pixels: CGFloat)] = [
("icon_16x16", 16), ("icon_16x16@2x", 32),
("icon_32x32", 32), ("icon_32x32@2x", 64),
("icon_128x128", 128), ("icon_128x128@2x", 256),
("icon_256x256", 256), ("icon_256x256@2x", 512),
("icon_512x512", 512), ("icon_512x512@2x", 1024)
]

try FileManager.default.createDirectory(atPath: outputDir, withIntermediateDirectories: true)

for (name, pixels) in sizes {
let size = NSSize(width: pixels, height: pixels)
let rendered = NSImage(size: size)
rendered.lockFocus()
NSGraphicsContext.current?.imageInterpolation = .high
source.draw(in: NSRect(origin: .zero, size: size), from: .zero, operation: .sourceOver, fraction: 1.0)
rendered.unlockFocus()

guard let tiff = rendered.tiffRepresentation,
let rep = NSBitmapImageRep(data: tiff),
let png = rep.representation(using: .png, properties: [:]) else {
FileHandle.standardError.write(Data("Failed to rasterize \(name)\n".utf8))
exit(1)
}
let url = URL(fileURLWithPath: outputDir).appendingPathComponent("\(name).png")
try png.write(to: url)
}

print("Wrote \(sizes.count) icon sizes to \(outputDir)")
Loading