Console.WriteLine("[Manager] Power Manager initialized. Monitoring lock and idle states...");
If you are presenting this feature in a technical document or to a team, here are the key points:
Windows can turn off the display immediately after locking, or after a fixed delay, independent of the normal power idle timeout. console lock display off timeout
# Get current display timeout for locked state (if policy exists) powercfg /query 7517b45c-37cc-42ac-811e-373ed62da29a
:
// Don't try to turn off if it's already locked (already handled) if (_isLocked) return;
If the "Console lock" timeout is shorter than the "Turn off display" timeout, the system will prioritize the lock timeout once the screen is locked. Console
// Sends command to wake up monitor. // Usually moving the mouse or pressing a key does this automatically in Windows, // but we force it here for robustness. SendMessage(IntPtr.Zero, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)MONITOR_ON);
private void IdleCheckTimer_Elapsed(object sender, ElapsedEventArgs e) // Sends command to wake up monitor
_isLocked = false; Console.WriteLine("[Event] Workstation Unlocked. Waking up display."); TurnOnDisplay();
Console.WriteLine("Application Started. Press 'Q' to quit.");