From 1056044ec429267ae82dc094b2ab808040482aa3 Mon Sep 17 00:00:00 2001 From: savcamarin Date: Wed, 15 Oct 2025 13:11:43 +0300 Subject: [PATCH 1/2] updated zen jiggle for macOS 26 --- AppDelegate.m | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/AppDelegate.m b/AppDelegate.m index 6ab7c2b..e9ba01c 100644 --- a/AppDelegate.m +++ b/AppDelegate.m @@ -72,7 +72,9 @@ - (NSImage *)imageTintedWithColor:(NSColor *)tint @end -@implementation AppDelegate +@implementation AppDelegate { + IOPMAssertionID _userActivityAssertion; +} #pragma mark Launch and Termination @@ -242,6 +244,27 @@ - (void)fixTimedQuitMenuItem #pragma mark Jiggling +- (void)declareUserActivity +{ + // Release any previous assertion before creating a new one + if (_userActivityAssertion != kIOPMNullAssertionID) { + IOPMAssertionRelease(_userActivityAssertion); + _userActivityAssertion = kIOPMNullAssertionID; + } + + // Create a short-lived "user is active" assertion to reset system idle timer + IOReturn result = IOPMAssertionCreateWithName( + kIOPMAssertionTypePreventUserIdleDisplaySleep, // tells macOS "the user just did something" + kIOPMAssertionLevelOn, + CFSTR("Jiggler Zen Jiggle Activity"), + &_userActivityAssertion + ); + + if (result != kIOReturnSuccess) { + NSLog(@"[Jiggler] Failed to declare user activity (IOReturn = 0x%x)", result); + } +} + - (BOOL)isInAScreen:(NSPoint)point { NSArray *screens = [NSScreen screens]; @@ -857,18 +880,21 @@ - (void)jiggleMouse:(id)unused // BCH 8 February 2015: UpdateSystemActivity() is officially deprecated beginning in 10.8. I am going // to continue using it until it actually goes away. // BCH 19 May 2016: Added weak linking protection to this, just in case Apple actually removes it... -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (UpdateSystemActivity != NULL) - UpdateSystemActivity(UsrActivity); -#pragma clang diagnostic pop +//#pragma clang diagnostic push +//#pragma clang diagnostic ignored "-Wdeprecated-declarations" +// if (UpdateSystemActivity != NULL) +// UpdateSystemActivity(UsrActivity); +//#pragma clang diagnostic pop // BCH 19 May 2016: Adding the new IOKit call IOPMAssertionDeclareUserActivity(), which appears to be equivalent // to UpdateSystemActivity(UsrActivity). It may have slightly different effects, so I'm keeping the call to // UpdateSystemActivity(UsrActivity) above as well, just to try to ensure the most complete coverage possible. - static IOPMAssertionID assertionID = kIOPMNullAssertionID; +// static IOPMAssertionID assertionID = kIOPMNullAssertionID; - IOPMAssertionDeclareUserActivity(CFSTR("Jiggler"), kIOPMUserActiveLocal, &assertionID); +// IOPMAssertionDeclareUserActivity(CFSTR("Jiggler"), kIOPMUserActiveLocal, &assertionID); + + // Replace the old UpdateSystemActivity() + IOPMAssertionDeclareUserActivity() + [self declareUserActivity]; [timeOfLastJiggle release]; timeOfLastJiggle = [[NSDate alloc] init]; From bdfbf78b599ecb0d88199467a0323f33af61697d Mon Sep 17 00:00:00 2001 From: savcamarin Date: Thu, 23 Oct 2025 06:34:44 +0300 Subject: [PATCH 2/2] fixed zen jiggle keeping system awake even when user locks the screen; --- AppDelegate.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/AppDelegate.m b/AppDelegate.m index e9ba01c..93d68e2 100644 --- a/AppDelegate.m +++ b/AppDelegate.m @@ -253,12 +253,11 @@ - (void)declareUserActivity } // Create a short-lived "user is active" assertion to reset system idle timer - IOReturn result = IOPMAssertionCreateWithName( - kIOPMAssertionTypePreventUserIdleDisplaySleep, // tells macOS "the user just did something" - kIOPMAssertionLevelOn, - CFSTR("Jiggler Zen Jiggle Activity"), - &_userActivityAssertion - ); + IOReturn result = IOPMAssertionDeclareUserActivity( + CFSTR("Jiggler Zen Jiggle Activity"), + kIOPMUserActiveLocal, + &_userActivityAssertion + ); if (result != kIOReturnSuccess) { NSLog(@"[Jiggler] Failed to declare user activity (IOReturn = 0x%x)", result);