Redline: sessions, review details on the PDF, and a UX rebuilt around a popover + a session window #30
@@ -81,6 +81,25 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
Task { await model.bootstrap() }
|
||||
// `--window` opens the session window at launch (scripts and demos); a normal
|
||||
// launch stays quiet in the menu bar.
|
||||
if CommandLine.arguments.contains("--window") {
|
||||
presentSessionsWindow()
|
||||
}
|
||||
}
|
||||
|
||||
/// Clicking the app in Finder, or `open -a Redline`, while it runs shows the
|
||||
/// window instead of doing nothing — standard macOS behaviour for a menu-bar app
|
||||
/// with a main window.
|
||||
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows: Bool) -> Bool {
|
||||
if !hasVisibleWindows {
|
||||
presentSessionsWindow()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private func presentSessionsWindow() {
|
||||
(model as SessionsWindowPresenting).presentSessionsWindow(focusLane: false)
|
||||
}
|
||||
|
||||
/// Builds the model exactly the way the real app launches: paths come from
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Installs the locally built Redline into /Applications and launches it with its
|
||||
# session window open, so the current build is what is on screen.
|
||||
#
|
||||
# ./scripts/install-local.sh
|
||||
#
|
||||
# The previously installed copy is kept at .build/Redline-<version>.app so the change
|
||||
# is reversible.
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILT="${ROOT}/.build/Redline.app"
|
||||
TARGET="/Applications/Redline.app"
|
||||
BUNDLE_ID="ai.flowmaster.shotdeck"
|
||||
|
||||
if [[ ! -d "${BUILT}" ]]; then
|
||||
echo "No ${BUILT}. Run ./scripts/build-app.sh first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "${TARGET}" ]]; then
|
||||
OLD_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${TARGET}/Contents/Info.plist")"
|
||||
BACKUP="${ROOT}/.build/Redline-${OLD_VERSION}.app"
|
||||
if [[ ! -d "${BACKUP}" ]]; then
|
||||
echo "==> Keeping the installed ${OLD_VERSION} at ${BACKUP}"
|
||||
ditto "${TARGET}" "${BACKUP}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "==> Quitting the running Redline"
|
||||
osascript -e 'quit app "Redline"' >/dev/null 2>&1 || true
|
||||
for _ in $(seq 1 40); do
|
||||
if ! pgrep -f "${TARGET}/Contents/MacOS/Shotdeck" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 0.25
|
||||
done
|
||||
pkill -f "${TARGET}/Contents/MacOS/Shotdeck" >/dev/null 2>&1 || true
|
||||
sleep 0.5
|
||||
|
||||
echo "==> Installing ${BUILT} to ${TARGET}"
|
||||
ditto "${BUILT}" "${TARGET}"
|
||||
|
||||
NEW_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${TARGET}/Contents/Info.plist")"
|
||||
echo "==> Launching Redline ${NEW_VERSION} with its window open"
|
||||
open -n "${TARGET}" --args --window
|
||||
|
||||
sleep 2
|
||||
if pgrep -f "${TARGET}/Contents/MacOS/Shotdeck" >/dev/null 2>&1; then
|
||||
echo "Redline ${NEW_VERSION} is running from ${TARGET}"
|
||||
else
|
||||
echo "Redline did not start" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user