Derived from OSIT MasterKey app (LegacyUtilities.m, Ian Kohl 2019). Uses CGConfigureDisplayMirrorOfDisplay — native macOS API, no Homebrew dependency. Handler now tries display_control first; falls back to displayplacer for missing binary or per-device configStr overrides. Build the binary via scripts/build-display-control.sh on a Mac (requires Xcode CLT only), then commit resources/bin/display_control. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.0 KiB
Bash
Executable File
41 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# scripts/build-display-control.sh
|
|
# Compile the display_control binary for macOS.
|
|
#
|
|
# Requirements: Xcode Command Line Tools
|
|
# xcode-select --install
|
|
#
|
|
# Run this on a Mac. Commit the resulting binary to resources/bin/
|
|
# so it is bundled into the packaged Electron app without any Homebrew dependency.
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
SRC="$SCRIPT_DIR/display_control.m"
|
|
OUT_DIR="$REPO_ROOT/resources/bin"
|
|
OUT_BIN="$OUT_DIR/display_control"
|
|
|
|
if ! command -v clang &>/dev/null; then
|
|
echo "ERROR: clang not found."
|
|
echo "Install Xcode Command Line Tools: xcode-select --install"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
|
|
echo "Building display_control..."
|
|
clang -framework Cocoa -framework Carbon \
|
|
-o "$OUT_BIN" "$SRC"
|
|
|
|
chmod +x "$OUT_BIN"
|
|
|
|
echo "Built: $OUT_BIN"
|
|
echo ""
|
|
echo "Test it:"
|
|
echo " $OUT_BIN status"
|
|
echo " $OUT_BIN extend"
|
|
echo " $OUT_BIN mirror"
|
|
echo ""
|
|
echo "Once verified, commit resources/bin/display_control to the repo."
|