Ambient system companions over one privacy-preserving signal daemon (aggregate-only, no keystroke content): a git-driven terminal garden and IOKit hardware collectors. ambient daemon macos privacy terminal

menubar-pet/scripts/bundle.sh

52 lines · 1638 bytes · executable

 1#!/bin/sh
 2# Assemble menubar-pet.app around the SwiftPM executable.
 3#
 4# SwiftPM cannot emit a .app, and a menu-bar app needs one: LSUIElement is what
 5# keeps it out of the Dock and off the window list. Rather than take on an
 6# .xcodeproj — which would stop `swift build` being the whole story and make
 7# the Homebrew formula harder — the bundle is four files and a script.
 8#
 9#   bundle.sh <built-executable> <output-dir>
10#
11# Writes <output-dir>/menubar-pet.app.
12set -eu
13
14exe=${1:?usage: bundle.sh <built-executable> <output-dir>}
15outdir=${2:?usage: bundle.sh <built-executable> <output-dir>}
16
17[ -x "$exe" ] || { echo "bundle.sh: $exe is not executable" >&2; exit 1; }
18
19app="$outdir/menubar-pet.app"
20rm -rf "$app"
21mkdir -p "$app/Contents/MacOS"
22
23cp "$exe" "$app/Contents/MacOS/menubar-pet"
24
25cat > "$app/Contents/Info.plist" <<'PLIST'
26<?xml version="1.0" encoding="UTF-8"?>
27<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
28<plist version="1.0">
29<dict>
30  <key>CFBundleName</key>
31  <string>menubar-pet</string>
32  <key>CFBundleDisplayName</key>
33  <string>Menubar Pet</string>
34  <key>CFBundleIdentifier</key>
35  <string>net.krz.ambient-companions.menubar-pet</string>
36  <key>CFBundleExecutable</key>
37  <string>menubar-pet</string>
38  <key>CFBundlePackageType</key>
39  <string>APPL</string>
40  <key>CFBundleInfoDictionaryVersion</key>
41  <string>6.0</string>
42  <key>LSMinimumSystemVersion</key>
43  <string>13.0</string>
44  <!-- Menu bar only: no Dock icon, no window. -->
45  <key>LSUIElement</key>
46  <true/>
47</dict>
48</plist>
49PLIST
50
51plutil -lint "$app/Contents/Info.plist" >/dev/null
52echo "$app"