Mission Control Turbo: macOS multitasking turbocharged
at main 105 lines 2.9 kB view raw
1#!/bin/bash 2set -euo pipefail 3 4# Load .env if present (for CERT_NAME etc.) 5ENV_FILE="$(dirname "$0")/.env" 6if [ -f "$ENV_FILE" ]; then 7 set -a 8 source "$ENV_FILE" 9 set +a 10fi 11 12CERT_NAME="${CERT_NAME:-}" 13 14APP_DIR="$(dirname "$0")/build/MCT.app" 15SDK=$(xcrun --show-sdk-path) 16 17echo "Building MCT..." 18 19# Kill running instance if any 20pkill -x MCT 2>/dev/null || true 21sleep 0.3 22 23# Create bundle structure 24mkdir -p "$APP_DIR/Contents/MacOS" "$APP_DIR/Contents/Resources" 25 26# Compile 27swiftc \ 28 -emit-executable \ 29 -o "$APP_DIR/Contents/MacOS/MCT" \ 30 -sdk "$SDK" \ 31 -target arm64-apple-macosx14.0 \ 32 -swift-version 5 \ 33 -O \ 34 -Xlinker -framework -Xlinker ScreenCaptureKit \ 35 MCT/Model/WindowInfo.swift \ 36 MCT/Model/WindowGroup.swift \ 37 MCT/Model/WindowSnapshot.swift \ 38 MCT/Model/LayoutState.swift \ 39 MCT/Model/GestureProgress.swift \ 40 MCT/API/WindowEnumerator.swift \ 41 MCT/API/ThumbnailCapture.swift \ 42 MCT/API/AccessibilityBridge.swift \ 43 MCT/API/HotKeyManager.swift \ 44 MCT/API/GestureMonitor.swift \ 45 MCT/Layout/LayoutGeometry.swift \ 46 MCT/Layout/LayoutEngine.swift \ 47 MCT/UI/SpringAnimator.swift \ 48 MCT/UI/OverlayWindowController.swift \ 49 MCT/UI/OverlayView.swift \ 50 MCT/UI/WindowThumbnailView.swift \ 51 MCT/UI/AppGroupHeaderView.swift \ 52 MCT/Settings/Preferences.swift \ 53 MCT/Settings/SettingsView.swift \ 54 MCT/App/AppDelegate.swift \ 55 MCT/App/MCTApp.swift 56 57# Info.plist 58cat > "$APP_DIR/Contents/Info.plist" << 'PLIST' 59<?xml version="1.0" encoding="UTF-8"?> 60<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 61<plist version="1.0"> 62<dict> 63 <key>CFBundleDevelopmentRegion</key> 64 <string>en</string> 65 <key>CFBundleExecutable</key> 66 <string>MCT</string> 67 <key>CFBundleIdentifier</key> 68 <string>com.mct.app</string> 69 <key>CFBundleInfoDictionaryVersion</key> 70 <string>6.0</string> 71 <key>CFBundleName</key> 72 <string>Mission Control Turbo</string> 73 <key>CFBundleDisplayName</key> 74 <string>Mission Control Turbo</string> 75 <key>CFBundlePackageType</key> 76 <string>APPL</string> 77 <key>CFBundleShortVersionString</key> 78 <string>1.0</string> 79 <key>CFBundleVersion</key> 80 <string>1</string> 81 <key>LSMinimumSystemVersion</key> 82 <string>14.0</string> 83 <key>LSUIElement</key> 84 <true/> 85 <key>NSHumanReadableCopyright</key> 86 <string>Copyright 2026. All rights reserved.</string> 87 <key>NSScreenCaptureUsageDescription</key> 88 <string>MCT needs Screen Recording permission to capture window thumbnails for the overlay.</string> 89 <key>NSAccessibilityUsageDescription</key> 90 <string>MCT needs Accessibility permission to register a global hotkey and activate windows.</string> 91</dict> 92</plist> 93PLIST 94 95echo -n "APPL????" > "$APP_DIR/Contents/PkgInfo" 96 97# Code-sign the app so macOS recognizes it for permission grants 98if [ -n "$CERT_NAME" ]; then 99 codesign --force --sign "$CERT_NAME" "$APP_DIR" 100else 101 codesign --force --sign - "$APP_DIR" 102fi 103 104echo "Built: $APP_DIR" 105open "$APP_DIR"