Two Windows desktop applications designed to prevent your computer from going to sleep or appearing idle/away.
This repository contains two different implementations:
Uses the official Windows SetThreadExecutionState API to prevent sleep mode.
Advantages:
- β Official Windows API
- β Clean and reliable
- β No interference with user input
- β Professional solution
- β Doesn't trigger security software
Best for: Professional use, presentations, long-running tasks, development workstations
Simulates subtle mouse movements to keep the system active.
Advantages:
- β Also prevents "Away" status in communication apps (Teams, Slack, etc.)
- β Simulates actual user presence
- β Configurable movement interval
Considerations:
β οΈ May interfere with user activity when activeβ οΈ Mouse moves 1 pixel right then left (minimal displacement)
Best for: When you need to appear "active" in status-tracking applications
- Windows 10/11
- .NET 9.0 SDK or later
-
Clone or navigate to the repository:
cd AllwaysOn
-
Build both applications:
# Build Power API version dotnet build AlwaysOn.PowerAPI/AlwaysOn.PowerAPI.csproj -c Release # Build Mouse Simulator version dotnet build AlwaysOn.MouseSimulator/AlwaysOn.MouseSimulator.csproj -c Release
-
Run the applications:
# Run Power API version dotnet run --project AlwaysOn.PowerAPI/AlwaysOn.PowerAPI.csproj # OR Run Mouse Simulator version dotnet run --project AlwaysOn.MouseSimulator/AlwaysOn.MouseSimulator.csproj
After building in Release mode, executables can be found at:
- PowerAPI:
AlwaysOn.PowerAPI\bin\Release\net9.0-windows\AlwaysOn.PowerAPI.exe - MouseSimulator:
AlwaysOn.MouseSimulator\bin\Release\net9.0-windows\AlwaysOn.MouseSimulator.exe
- Launch the application
- Click "Enable Keep Awake" to activate
- Your computer and display will stay on indefinitely
- Click "Disable Keep Awake" to restore normal power management
- Minimize to system tray for background operation
Features:
- System tray integration
- Activity logging
- Visual status indicator
- Automatic cleanup on exit
- Launch the application
- Set the movement interval (default: 1 minute)
- Click "Start Simulation" to activate
- The mouse will move imperceptibly at the specified interval
- Use "Test Movement" button to test a single movement
- Click "Stop Simulation" to deactivate
Features:
- Configurable interval (1-60 minutes)
- Movement counter
- Test movement function
- System tray integration
- Activity logging
- β Keeping computer awake during presentations
- β Long-running downloads or data transfers
- β Remote desktop sessions
- β Development builds and compilations
- β Video rendering or processing tasks
- β Maintaining "Available" status in Microsoft Teams/Slack
- β Preventing auto-lock during meetings (when camera is off)
- β Time-tracking applications that monitor activity
- β Remote work scenarios where presence matters
SetThreadExecutionState(
ES_CONTINUOUS |
ES_DISPLAY_REQUIRED |
ES_SYSTEM_REQUIRED
);// Moves 1 pixel right, then 1 pixel left (returns to origin)
mouse_event(MOUSEEVENTF_MOVE, 1, 0, 0, 0);
Thread.Sleep(50);
mouse_event(MOUSEEVENTF_MOVE, -1, 0, 0, 0);AllwaysOn/
βββ AlwaysOn.PowerAPI/
β βββ MainForm.cs
β βββ MainForm.Designer.cs
β βββ Program.cs
β βββ AlwaysOn.PowerAPI.csproj
βββ AlwaysOn.MouseSimulator/
β βββ MainForm.cs
β βββ MainForm.Designer.cs
β βββ Program.cs
β βββ AlwaysOn.MouseSimulator.csproj
βββ README.md
- Framework: .NET 9.0 (Windows Forms)
- OS: Windows 10/11
- APIs Used:
kernel32.dll- SetThreadExecutionState (Power API)user32.dll- mouse_event (Mouse Simulator)
# Restore dependencies
dotnet restore
# Build in Debug mode
dotnet build
# Build in Release mode
dotnet build -c Release
# Clean build artifacts
dotnet clean-
Power API Version:
- Automatically restores normal power settings when the application closes
- Does NOT prevent manual sleep (closing laptop lid, pressing sleep button)
- Works system-wide for all power settings
-
Mouse Simulator Version:
- May interfere if you're actively using the mouse during simulation
- The movement is minimal (1 pixel) and returns to original position
- Can be detected by advanced monitoring tools
- Consider pausing during active work
-
General:
- Both apps respect system tray minimize behavior
- Activity logs help track when keep-awake was active
- Always clean up on application exit
Both applications support minimizing to the system tray:
- Double-click the tray icon to restore the window
- Right-click for quick menu options
- Tray icon shows balloon tips for status changes
- β No network connections
- β No data collection
- β No external dependencies
- β Open source - review the code yourself
- β Runs entirely locally on your machine
Β© 2025 - Free to use and modify
Feel free to fork, modify, and enhance these applications!
- Add scheduling feature (enable/disable at specific times)
- Auto-start with Windows option
- Global hotkey support
- Multiple power profiles
- Network activity prevention
- Custom tray icons
- Settings persistence
These applications are tools to prevent automatic system sleep. They should be used responsibly:
- Don't use to circumvent workplace policies
- Be mindful of energy consumption
- Don't leave unattended for extended periods
- Ensure proper cooling for long-duration use
For issues, questions, or suggestions:
- Check if the issue exists in the code
- Review the README for usage instructions
- Test with both Debug and Release builds
Made with β€οΈ for Windows users who need to keep their systems awake!