- PRs are welcome
- All code must pass the
shellcheck
(runmake lint
) - Use
test
instead of[[ ... ]]
for simple tests (equality, empty, non-empty checks) - Use
(( math test ))
for complex math conditions - Use
(( math assignment ))
for doing math - Use
local
for defining local variables - Use
if
,then
,elif
,else
,fi
instead of chaining&&
and||
- Try to cover new features in the
clamshell-selftest()
function (self-contained test in clamshell.sh)
All features must be accessible through the clamshell.sh script!
- Before development,
clamshell uninstall
the LaunchAgent - During development, use
./clamshell.sh COMMAND
to test all affected features - Before committing, run
./clamshell.sh install
and thenclamshell COMMAND
to test again - Run
clamshell selftest
andmake test
regularly
The MacOS LaunchAgent will run clamshell daemon
, which tries to put the system to sleep continuously. If Apple changes how MacOS works in a very unexpected way, this may prevent the user from interacting with the system.
Therefore clamshell daemon
excercises two circuit breakers to allow for stopping the daemon.
These circuit breakers must be tested regularly!
- Run
clamshell idle
to check if the idle timeout is working - Run
clamshell load
and enter clamshell mode (close the lid) and wait 30 Seconds. - Press a key and start moving the mouse every 2 Seconds (keep the lid closed)
- Login in to MacOS (typing your password also resets the idle timer)
- Enter
clamshell unload
(you can stop moving the mouse now) - See
clamshell log
to observe idle handling.
- Run
clamshell load
and enter clamshell mode (close the lid) - After 5 Seconds, activate the system (keep the lid closed)
- Login quickly (you have 30 Seconds in total)
- Enter
clamshell unload
- Check
clamshell log
that the last message was "waiting 30s after sleep attempt"
Once installed the LaunchAgent will be active most of the time, with some pauses during reboot.
- How does this affect OS or regular software updates?
- Can updates still finish in clamshell mode?
- Which unexpected effects does the agent have in context of updates?
- Start the LaunchAgent (
clamshell install
) - Start an OS update (incl. a scheduled restart)
- Enter clamshell mode
- Wake up the system and login a few times (keep lid closed)
- Observe whether or not MacOS will stop/override the agent
- Observe when the agent becomes active after boot
- and whether or not it prevents some final update steps to be completed.
Keep the lid open during updates or just clamshell uninstall
before the update!