mirror of
https://github.com/carey314/mio-plugin-airdrop.git
synced 2026-06-11 03:54:33 +00:00
Quick-access AirDrop from the notch panel. Tap the card body, pick files via NSOpenPanel, hand off to NSSharingService(.sendViaAirDrop). No private APIs, no entitlements, no network — just a thin wrapper around the same AirDrop API Finder uses. Design constraint: drag-and-drop is intentionally not implemented. MioIsland's notch panel auto-collapses on click-outside, which breaks the Cmd-Tab-to-Finder / grab / drag-back workflow before the drop target reaches. Tap-to-choose is rock solid by comparison. Requires MioIsland host v2.2.0+ (panel size clamp floor was lowered to 120pt in that release).
57 lines
1.6 KiB
Bash
Executable File
57 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build the AirDrop plugin as a .bundle for MioIsland
|
|
set -e
|
|
|
|
PLUGIN_NAME="airdrop"
|
|
MODULE_NAME="AirDropPlugin"
|
|
BUNDLE_NAME="${PLUGIN_NAME}.bundle"
|
|
BUILD_DIR="build"
|
|
|
|
# Recursively pick up every .swift under Sources/ (root + subdirectories
|
|
# like services/, ui/, support/ for the layered layout).
|
|
SOURCES=$(find Sources -name "*.swift" -type f)
|
|
|
|
echo "Building ${PLUGIN_NAME} plugin..."
|
|
echo "Compiling $(echo "$SOURCES" | wc -l | tr -d ' ') Swift files..."
|
|
|
|
# Clean
|
|
rm -rf "${BUILD_DIR}"
|
|
mkdir -p "${BUILD_DIR}/${BUNDLE_NAME}/Contents/MacOS"
|
|
|
|
# Compile to dynamic library
|
|
swiftc \
|
|
-emit-library \
|
|
-module-name "${MODULE_NAME}" \
|
|
-target arm64-apple-macos15.0 \
|
|
-sdk $(xcrun --show-sdk-path) \
|
|
-o "${BUILD_DIR}/${BUNDLE_NAME}/Contents/MacOS/${MODULE_NAME}" \
|
|
${SOURCES}
|
|
|
|
# Copy Info.plist
|
|
cp Info.plist "${BUILD_DIR}/${BUNDLE_NAME}/Contents/"
|
|
|
|
# Optional resources
|
|
if [ -d "Resources" ] && [ "$(ls -A Resources 2>/dev/null)" ]; then
|
|
mkdir -p "${BUILD_DIR}/${BUNDLE_NAME}/Contents/Resources"
|
|
cp -R Resources/* "${BUILD_DIR}/${BUNDLE_NAME}/Contents/Resources/"
|
|
fi
|
|
|
|
# Ad-hoc sign
|
|
codesign --force --deep --sign - "${BUILD_DIR}/${BUNDLE_NAME}"
|
|
|
|
echo "✓ Built ${BUILD_DIR}/${BUNDLE_NAME}"
|
|
|
|
# Create zip for marketplace upload
|
|
cd "${BUILD_DIR}"
|
|
rm -f "${PLUGIN_NAME}.zip"
|
|
zip -rq "${PLUGIN_NAME}.zip" "${BUNDLE_NAME}"
|
|
cd ..
|
|
|
|
echo "✓ Created ${BUILD_DIR}/${PLUGIN_NAME}.zip (for marketplace upload)"
|
|
echo ""
|
|
echo "Install locally:"
|
|
echo " cp -r ${BUILD_DIR}/${BUNDLE_NAME} ~/.config/codeisland/plugins/"
|
|
echo ""
|
|
echo "Upload to marketplace:"
|
|
echo " ${BUILD_DIR}/${PLUGIN_NAME}.zip"
|