- Detect an external display as any online display that isn't built in (CGGetOnlineDisplayList + CGDisplayIsBuiltin) instead of counting NSScreens, so the rule works in clamshell mode, when mirroring and on single-monitor desktops. The Smart Activation footer reports the same check. - Refuse and mark shortcut presets that clash with a macOS system shortcut (CopySymbolicHotKeys, checked once, only when the Global Shortcut submenu opens), report the real reason a registration failed, and stop claiming that other apps' clashes are detected. Show the shortcut hint on the toggle only when it is actually registered. - Make the menu toggle carry the action it displays, refresh the status line, toggle and "Add 30 minutes" while the menu is open, and ignore a click that lands as the toggle changes meaning, so a click never does the opposite of its label. - Replace the single suppression flag with per-rule overrides: the status names what is paused, Turn On becomes Resume Smart Activation, each rule re-arms when it stops holding, and a rule that became true during a timed session takes over at expiry while rules that held throughout stay paused. - Update the README to match, bump the version to 1.1.0 and add CHANGELOG.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
79 lines
2.6 KiB
Makefile
79 lines
2.6 KiB
Makefile
APP_NAME := Wakeful
|
|
BUNDLE_ID := com.github.wakeful.Wakeful
|
|
VERSION := 1.1.0
|
|
|
|
# Override with: make SIGN_ID="Developer ID Application: Your Name (TEAMID)"
|
|
SIGN_ID ?= -
|
|
|
|
# ?= so `bundle` can be re-invoked with a different source directory.
|
|
BUILD_DIR ?= .build/release
|
|
UNIVERSAL_DIR := .build/apple/Products/Release
|
|
DIST := dist
|
|
APP := $(DIST)/$(APP_NAME).app
|
|
CONTENTS := $(APP)/Contents
|
|
|
|
# A secure timestamp is required for notarization but impossible for ad-hoc.
|
|
TS := $(if $(filter -,$(SIGN_ID)),--timestamp=none,--timestamp)
|
|
|
|
.PHONY: all build universal app app-universal bundle sign install uninstall run clean
|
|
|
|
all: app
|
|
|
|
## Build for this Mac's architecture only (fast).
|
|
build:
|
|
swift build -c release
|
|
|
|
## Build a universal (arm64 + x86_64) binary. Note SwiftPM writes multi-arch
|
|
## builds to a different directory, which is why `bundle` is parameterised.
|
|
universal:
|
|
swift build -c release --arch arm64 --arch x86_64
|
|
|
|
## Assemble and sign Wakeful.app into ./dist
|
|
app: build bundle
|
|
|
|
## Same, from a universal binary.
|
|
app-universal: universal
|
|
$(MAKE) bundle BUILD_DIR=$(UNIVERSAL_DIR)
|
|
|
|
bundle:
|
|
rm -rf "$(APP)"
|
|
mkdir -p "$(CONTENTS)/MacOS" "$(CONTENTS)/Resources"
|
|
cp "$(BUILD_DIR)/$(APP_NAME)" "$(CONTENTS)/MacOS/$(APP_NAME)"
|
|
sed -e 's|__BUNDLE_ID__|$(BUNDLE_ID)|g' \
|
|
-e 's|__VERSION__|$(VERSION)|g' \
|
|
Resources/Info.plist > "$(CONTENTS)/Info.plist"
|
|
printf 'APPL????' > "$(CONTENTS)/PkgInfo"
|
|
$(MAKE) sign
|
|
@echo ""
|
|
@echo "Built $(APP)"
|
|
@echo "Run 'make install' to copy it to /Applications and launch it."
|
|
|
|
## Code-sign the bundle. Ad-hoc by default; pass SIGN_ID for a real identity.
|
|
sign:
|
|
codesign --force --options runtime $(TS) --sign "$(SIGN_ID)" "$(APP)"
|
|
codesign --verify --verbose=2 "$(APP)"
|
|
|
|
## Install to /Applications and launch. Login-item registration needs the app
|
|
## to live in a stable location, so install before enabling Launch at Login.
|
|
install: app
|
|
- osascript -e 'quit app "$(APP_NAME)"' 2>/dev/null || true
|
|
rm -rf "/Applications/$(APP_NAME).app"
|
|
cp -R "$(APP)" /Applications/
|
|
open "/Applications/$(APP_NAME).app"
|
|
|
|
uninstall:
|
|
- osascript -e 'quit app "$(APP_NAME)"' 2>/dev/null || true
|
|
rm -rf "/Applications/$(APP_NAME).app"
|
|
defaults delete $(BUNDLE_ID) 2>/dev/null || true
|
|
@echo "Removed. If Launch at Login was on, also check"
|
|
@echo "System Settings > General > Login Items & Extensions."
|
|
|
|
## Run the built binary straight from the terminal (for debugging).
|
|
## Note: Preferences and Launch at Login only behave correctly in the .app bundle.
|
|
run: build
|
|
"$(BUILD_DIR)/$(APP_NAME)"
|
|
|
|
clean:
|
|
swift package clean
|
|
rm -rf .build "$(DIST)"
|