x74353/Amphetamine-Enhancer

No "Closed-Display Mode Fail-Safe" option

Opened this issue · 5 comments

I'm using M2 Macbook Air and can't find the "Closed-Display Mode Fail-Safe" option:

image

This is a bug that will affect the M2 Air and Pro.

The option’s not being shown because Amphetamine is looking at the machine’s model identifier and seeing if it contains “Book” to check it’s a laptop.

For the M2 MacBook Pro and Air, Apple changed the model identifier to Mac14,7 and Mac14,2 respectively, so this lookup fails and the option doesn’t show.

When you select this option (if it shows), it adds and launches the cdm-manager plist file to launchctl, which when triggered, runs this script.

You can re-create this manually by copying the amphetamine-enhancer-cdmManager.plist to /Library/LaunchAgents and then running the following in terminal:

launchctl load -w /Library/LaunchAgents/amphetamine-enhancer-cdmManager.plist

launchctl start amphetamine-enhancer-cdmManager

That being said, I investigated this with the intention of making sure my M2 Air didn't sleep when on battery and connected to an external monitor, but this didn't work and my Air still goes to sleep. I think the way this is handled in M2 (and maybe M1) macs is different and so the CDM manager code just doesn't work.

I wanted this for battery preservation (to not leave it at 100% all the time), and so my eventual solution was just to keep the Macbook connect to charge, but to use AlDente to manage the battery.

Mmm that's a bummer :/

My solution is run two bash scripts to switch on or off hibernation and sleep settings and enable clamshell mode without AC cable attached, independently from the app.

Run clam-sleep-off.sh to disable hibernation and sleep. This allows clamshell mode without AC ot happen basically..

Run clam-sleep-on.sh to restore default hib&sleep settings.

clam-sleep-off.sh

#!/usr/bin/env bash

#Disables sleep and hibernation
#allowing to use a second monitor with the lid closed

hib_mode="$(pmset -g | grep hibernatemode | grep -Eo "\d")"
sleep_mode="$(pmset -g | grep "\bsleep\b" | grep -Eo "\d")"
sleep_off="$(pmset -g | grep SleepDisabled | grep -Eo "\d")"

printf "\nRunning %s\n" "$0"

printf "The current hibernation mode is %s, default is 3 for Macbooks\n\n" "$hib_mode";


sudo pmset -a sleep 0 && printf "sleep set to %s\n" "$sleep_mode";

sudo pmset -a hibernatemode 0 && printf "hibernation mode set to %s\n" "$hib_mode";

sudo pmset -a disablesleep 1 && printf "SleepDisable is set to %s\n\n" "$sleep_off"

echo "Hibernation and sleep disabled. Clamsheel mode without AC activated"

clam-sleep-on.sh

#!/usr/bin/env bash

#Restores default settings for sleep and hibernation
#After running this script
#clamsheel mode requires the AC power connected to the mbpro

hib_mode="$(pmset -g | grep hibernatemode | grep -Eo "\d")"
sleep_mode="$(pmset -g | grep "\bsleep\b" | grep -Eo "\d")"
sleep_off="$(pmset -g | grep SleepDisabled | grep -Eo "\d")"

printf "\nRunning %s\n" "$0"

printf "The current hibernation mode is %s, default is 3 for Macbooks\n\n" "$hib_mode";


sudo pmset -a sleep 1 && printf "sleep set to %s\n" "$sleep_mode";

sudo pmset -a hibernatemode 3 && printf "hibernation mode set to %s\n" "$hib_mode";

sudo pmset -a disablesleep 0 && printf "SleepDisable is set to %s\n\n" "$sleep_off"

echo "Hibernation and sleep default settings restored"

little update for anyone still looking for a solution, the developer quietly released an updated testflight build on their twitter that fixes this issue! the enhancer tool doesn’t have a testflight but it seems to work just fine without it so far.

It kinda fixed it for me but again it appeared. Grayed out for me with the testflight build.

Has that TestFlight build been pushed to stable release yet?