From 27e3b11c5792f131a5100caf3b7eb9639d3e3266 Mon Sep 17 00:00:00 2001 From: Charlie Chiang Date: Wed, 9 Oct 2024 09:29:34 +0800 Subject: [PATCH] fix: do not turn off led when waking and controlling magsafe led is disabled --- conf.go | 5 ++++- sleepcallback.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf.go b/conf.go index 8a6ab7a..f0f0245 100644 --- a/conf.go +++ b/conf.go @@ -30,7 +30,10 @@ var ( DisableChargingPreSleep: true, AllowNonRootAccess: false, LowerLimitDelta: 2, - ControlMagSafeLED: true, // no well-tested yet + // There are Macs without MagSafe LED. We only do checks when the user + // explicitly enables this feature. In the future, we might add a check + // that disables this feature if the Mac does not have a MagSafe LED. + ControlMagSafeLED: false, } ) diff --git a/sleepcallback.go b/sleepcallback.go index 2d4730f..780b210 100644 --- a/sleepcallback.go +++ b/sleepcallback.go @@ -141,7 +141,7 @@ func systemHasPoweredOnCallback() { // actually want the sleep to prolong as well. sleep(postSleepLoopDelaySeconds) - if config.DisableChargingPreSleep { + if config.DisableChargingPreSleep && config.ControlMagSafeLED { err := smcConn.SetMagSafeLedState(smc.LedOff) if err != nil { logrus.Errorf("SetMagSafeLedState failed: %v", err)