The lid is not a reliable signal on its own, so StayGreen treats it as one input to a decision rather than a trigger.
Windows broadcasts a power-setting notification when the lid state changes. StayGreen registers for it and, on a close, queries how many active monitors the system reports. If that count is zero, the machine genuinely has no display surface and the honest interpretation is that nobody is looking at it — so the hold is released and the pause reason is recorded as "lid closed". If the count is non-zero, an external display is attached and the session is still in use, so nothing changes. This is the whole rule, and it exists specifically because docking is the common case where the naive interpretation of a closed lid is wrong.
A pause is not an off. When a hardware rule pauses the hold, StayGreen enters a distinct paused state rather than switching off. The tray icon changes colour to show it, and when the condition clears the hold resumes without you touching anything. This matters because the alternative — turning off on the first pause — means you come back to a machine that quietly stopped doing what you asked an hour ago.
The desktop guard. If Windows reports that the system has no battery, the lid rule and both battery rules are disabled entirely. A desktop should not inherit laptop safety logic, and a spurious lid or AC signal on a machine with neither should not pause anything.
What it will not do. It will not stop the machine locking, and it does not try to. When the session locks, StayGreen clears any timed session and releases everything — a keep-awake tool that defeated your lock screen would be a security problem, not a feature. On unlock it does not silently resume; it tells you it turned itself off and waits for you. It also cannot override Modern Standby on battery: on hardware that uses it, the system takes over regardless of what any application asks for, and no application can beat that. StayGreen detects Modern Standby support and shows an advisory so the behaviour is not a mystery, but it does not pretend to work around it.
One more limit worth stating: there is no thermal condition in this. StayGreen detects no temperature or throttling state, and the only reasons it will ever pause are on battery, Battery Saver being on, and the lid rule above.