feat: enhance AI Workspace Menu Bar App with packaging scripts, login management, and service status improvements
This commit is contained in:
40
apps/mac/AIWorkspace/scripts/install-start-at-login.sh
Normal file
40
apps/mac/AIWorkspace/scripts/install-start-at-login.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
APP_PATH="${APP_PATH:-$HOME/Applications/AIWorkspace.app}"
|
||||
PLIST_PATH="$HOME/Library/LaunchAgents/com.aiworkspace.menu.plist"
|
||||
|
||||
if [[ ! -d "$APP_PATH" ]]; then
|
||||
echo "App not found: $APP_PATH" >&2
|
||||
echo "Run apps/mac/AIWorkspace/scripts/package-app.sh --install first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/Library/LaunchAgents"
|
||||
|
||||
cat > "$PLIST_PATH" <<PLIST
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.aiworkspace.menu</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/bin/open</string>
|
||||
<string>-a</string>
|
||||
<string>$APP_PATH</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>StandardOutPath</key>
|
||||
<string>$HOME/Library/Logs/AIWorkspace-menu.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>$HOME/Library/Logs/AIWorkspace-menu.err.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
|
||||
launchctl unload "$PLIST_PATH" >/dev/null 2>&1 || true
|
||||
launchctl load "$PLIST_PATH"
|
||||
echo "Installed and loaded LaunchAgent: $PLIST_PATH"
|
||||
64
apps/mac/AIWorkspace/scripts/package-app.sh
Normal file
64
apps/mac/AIWorkspace/scripts/package-app.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
APP_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
WORKSPACE_ROOT="$(cd "$APP_ROOT/../../.." && pwd)"
|
||||
|
||||
CONFIGURATION="${CONFIGURATION:-release}"
|
||||
APP_NAME="AIWorkspace"
|
||||
BUILD_DIR="$APP_ROOT/.build/$CONFIGURATION"
|
||||
OUTPUT_DIR="$APP_ROOT/dist"
|
||||
APP_BUNDLE="$OUTPUT_DIR/$APP_NAME.app"
|
||||
INSTALL_DIR="${INSTALL_DIR:-$HOME/Applications}"
|
||||
|
||||
INSTALL=0
|
||||
if [[ "${1:-}" == "--install" ]]; then
|
||||
INSTALL=1
|
||||
fi
|
||||
|
||||
swift build --package-path "$APP_ROOT" -c "$CONFIGURATION"
|
||||
|
||||
rm -rf "$APP_BUNDLE"
|
||||
mkdir -p "$APP_BUNDLE/Contents/MacOS" "$APP_BUNDLE/Contents/Resources"
|
||||
cp "$BUILD_DIR/$APP_NAME" "$APP_BUNDLE/Contents/MacOS/$APP_NAME"
|
||||
|
||||
cat > "$APP_BUNDLE/Contents/Info.plist" <<PLIST
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$APP_NAME</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.aiworkspace.menu</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>AI Workspace</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>13.0</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Local AI Workspace utility.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
|
||||
echo "Built $APP_BUNDLE"
|
||||
|
||||
if [[ "$INSTALL" == "1" ]]; then
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
rm -rf "$INSTALL_DIR/$APP_NAME.app"
|
||||
cp -R "$APP_BUNDLE" "$INSTALL_DIR/$APP_NAME.app"
|
||||
echo "Installed $INSTALL_DIR/$APP_NAME.app"
|
||||
fi
|
||||
7
apps/mac/AIWorkspace/scripts/uninstall-start-at-login.sh
Normal file
7
apps/mac/AIWorkspace/scripts/uninstall-start-at-login.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PLIST_PATH="$HOME/Library/LaunchAgents/com.aiworkspace.menu.plist"
|
||||
launchctl unload "$PLIST_PATH" >/dev/null 2>&1 || true
|
||||
rm -f "$PLIST_PATH"
|
||||
echo "Removed LaunchAgent: $PLIST_PATH"
|
||||
Reference in New Issue
Block a user