cmux/scripts/reloadp.sh
Lawrence Chen dd2eeae503
Stop reload scripts from stealing window focus (#988)
Use `open -g` (background) and remove `osascript activate` calls across
reload.sh, reloadp.sh, and reloads.sh so rebuilds no longer yank focus
away from the active window.
2026-03-05 21:19:08 -08:00

20 lines
710 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux -configuration Release -destination 'platform=macOS' build
pkill -x cmux || true
sleep 0.2
APP_PATH="$(
find "$HOME/Library/Developer/Xcode/DerivedData" -path "*/Build/Products/Release/cmux.app" -print0 \
| xargs -0 /usr/bin/stat -f "%m %N" 2>/dev/null \
| sort -nr \
| head -n 1 \
| cut -d' ' -f2-
)"
if [[ -z "${APP_PATH}" ]]; then
echo "cmux.app not found in DerivedData" >&2
exit 1
fi
# Dev shells (including CI/Codex) often force-disable paging by exporting these.
# Don't leak that into cmux, otherwise `git diff` won't page even with PAGER=less.
env -u GIT_PAGER -u GH_PAGER open -g "$APP_PATH"