-
Notifications
You must be signed in to change notification settings - Fork 50
Comparing changes
Open a pull request
base repository: domzilla/Caffeine
base: master
head repository: bubbleee030/Caffeine
compare: master
- 10 commits
- 32 files changed
- 1 contributor
Commits on May 18, 2026
-
Add Swift Package test scaffold and IO backend protocols
Introduces a root Package.swift that compiles a subset of model code into a CaffeineCore library so swift test can run automated unit tests without touching the Xcode project. Adds two backend protocols that abstract the system APIs that subsequent milestones will depend on: - LaunchItemBackend wraps SMAppService.mainApp for login-item registration. - PowerAssertionBackend wraps IOPMAssertionCreateWithDescription / IOPMAssertionRelease for sleep prevention. Includes a smoke test exercising the default implementations.
Configuration menu - View commit details
-
Copy full SHA for f9a0d87 - Browse repository at this point
Copy the full SHA f9a0d87View commit details -
Add Launch at Login preference
Adds a new "Launch at Login" toggle in Preferences that registers the app as a macOS login item via SMAppService.mainApp. The published state mirrors the underlying SMAppService status so manual toggles in System Settings flow back into the UI on next appearance. Tests cover register/unregister wiring, the no-op-when-already-enabled case, and recovery when the backend throws.
Configuration menu - View commit details
-
Copy full SHA for 2ebef57 - Browse repository at this point
Copy the full SHA 2ebef57View commit details -
Allow Mac to run with lid closed; prevent system idle sleep
Adds an "Allow Mac to run with lid closed" preference. SleepPreventionManager now holds up to three IOPMAssertions while active: - PreventUserIdleDisplaySleep (display does not dim from inactivity) - PreventUserIdleSystemSleep (system does not idle-sleep — previously absent) - PreventSystemSleep (only when the new flag is on, lets the Mac keep running with the lid closed on AC power) The assertion timeout is bumped from 8 s to 30 s so the 10 s refresh always overlaps; the previous values left a 2 s gap every cycle. The manager accepts an injected PowerAssertionBackend so tests can verify which assertion types are created. Toggling the flag while active applies live without re-activating. Integration smoke test in scripts/integration-test.sh launches the built app with a debug env var, then verifies `pmset -g assertions` reflects the expected types.Configuration menu - View commit details
-
Copy full SHA for 1d4bbad - Browse repository at this point
Copy the full SHA 1d4bbadView commit details -
Add Traditional Chinese localization and new preference strings
Adds zh-Hant.lproj/Localizable.strings (full translation) and appends the three new preference strings — "Launch at Login", "Allow Mac to run with lid closed", and the AC-power caveat — to every shipped locale (best-effort native translations for de/es/fr/it/nl/pt/pt-BR/ru/uk; native review welcome via follow-up PRs). LocalizationTests parses each .strings file and asserts the full key set is present, so future user-facing strings can't land without updating every locale.
Configuration menu - View commit details
-
Copy full SHA for 671fece - Browse repository at this point
Copy the full SHA 671feceView commit details -
Rewrite README; add Traditional Chinese tutorial; update CHANGELOG
The README now describes this fork (bubbleee030/Caffeine) instead of the upstream project's download page and support contact. Adds a tutorial for the two new toggles, including a `pmset -g assertions` verification step, a Languages section listing all 14 shipped locales, and a Building from source section. The original FAQ entries are kept and the alternatives question is updated to reflect that this fork now provides lid-close parity with Amphetamine. README.zh-Hant.md mirrors the English README with localized headings and Taiwan-style vocabulary so Traditional-Chinese readers get the same information without an English detour.
Configuration menu - View commit details
-
Copy full SHA for 8479dbc - Browse repository at this point
Copy the full SHA 8479dbcView commit details
Commits on May 19, 2026
-
Configuration menu - View commit details
-
Copy full SHA for d023dd7 - Browse repository at this point
Copy the full SHA d023dd7View commit details -
#1 SleepPreventionManager.refreshAssertions now creates the three new assertions before releasing the old IDs, so the kernel always sees at least one of each type during a refresh (swap-then-release, not release-then-create). The doc comment claimed overlap but the code left a microsecond gap. New testRefreshCreatesNewAssertionsBeforeReleasingOld pins the ordering via an operationLog on the test fake. #2 NSWorkspace session observers now use the Combine publisher API with AnyCancellable, so they detach automatically when the manager deallocates. The previous selector-based addObserver retained the target forever — fine for the production singleton, but every test that constructed a SleepPreventionManager(backend:) leaked two observers. testManagerDeallocatesWhenOutOfScope proves the leak is fixed via a weak ref. #3 LaunchAtLoginManager.setEnabled now logs the underlying error via os.Logger (subsystem net.domzilla.caffeine, visible in Console.app) and surfaces it on a public `lastError` property so the UI layer can present it to the user. refresh() still snaps the published isEnabled back to the backend truth, so a failed register visually pops the Toggle back to off. Two new tests cover lastError set on throw and cleared on next success. #4 scripts/integration-test.sh replaces the fixed 3 s sleep with a poll_for_caffeine_assertions helper that retries pmset every second until Caffeine-owned assertions appear (default 30 s timeout, overridable via ASSERTION_POLL_TIMEOUT). Avoids flakiness on slow runners where SwiftUI initialization takes longer than 3 s.
Configuration menu - View commit details
-
Copy full SHA for 1b6388c - Browse repository at this point
Copy the full SHA 1b6388cView commit details -
Address PR #1 second-round review feedback
#5 PreferencesView no longer writes CAAllowLidClose to UserDefaults twice. CaffeineViewModel.setAllowLidClose now only forwards the new flag to SleepPreventionManager; persistence is owned by PreferencesView's @AppStorage binding. #6 SleepPreventionManager now releases its assertion IDs immediately when the user session resigns active, and re-engages immediately on become- active rather than waiting up to 10 s for the next timer tick. The old early-return in refreshAssertions left the manager's stored IDs in a stale state after the kernel timed them out at 30 s. Three new tests cover resign-releases, become-reengages, and become-while-inactive does nothing. #7 CA_TEST_AUTOACTIVATE no longer writes to standard UserDefaults. The activate(...) function takes a new allowLidCloseOverride parameter so the test hook can drive a known state without mutating persistent preferences. The intentional early-return is documented in comments. #8 LocalizationTests no longer relies on a single representative key ("Quit") to prove zh-Hant differs from zh-Hans. Asserts that at least half of all 31 user-facing values are non-identical across the two locales. #9 About-dialog credits now point at github.com/bubbleee030/Caffeine instead of github.caffeine-app.net, in line with the README rewrite. Added a 2026 @bubbleee030 line to the copyright credits. Updated the source string in MenuBarController and the localized value in all 14 .lproj/Localizable.strings files; LocalizationTests reflects the new key. No remaining caffeine-app.net references in the repo.
Configuration menu - View commit details
-
Copy full SHA for 7f6b451 - Browse repository at this point
Copy the full SHA 7f6b451View commit details -
Merge pull request #1 from bubbleee030/feature/launch-at-login-and-li…
…d-close Add Launch at Login + lid-close support, Traditional Chinese, automated tests
Configuration menu - View commit details
-
Copy full SHA for b6f504e - Browse repository at this point
Copy the full SHA b6f504eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7b1d7f3 - Browse repository at this point
Copy the full SHA 7b1d7f3View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff master...master