Skip to content

armas77/AlwaysOn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Always On - Windows Keep Awake Applications

Two Windows desktop applications designed to prevent your computer from going to sleep or appearing idle/away.

πŸ“¦ Projects

This repository contains two different implementations:

1. AlwaysOn.PowerAPI (⭐ Recommended)

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

2. AlwaysOn.MouseSimulator

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


πŸš€ Quick Start

Prerequisites

  • Windows 10/11
  • .NET 9.0 SDK or later

Building the Applications

  1. Clone or navigate to the repository:

    cd AllwaysOn
  2. 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
  3. 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

Executables Location

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

πŸ“– Usage

AlwaysOn.PowerAPI

  1. Launch the application
  2. Click "Enable Keep Awake" to activate
  3. Your computer and display will stay on indefinitely
  4. Click "Disable Keep Awake" to restore normal power management
  5. Minimize to system tray for background operation

Features:

  • System tray integration
  • Activity logging
  • Visual status indicator
  • Automatic cleanup on exit

AlwaysOn.MouseSimulator

  1. Launch the application
  2. Set the movement interval (default: 1 minute)
  3. Click "Start Simulation" to activate
  4. The mouse will move imperceptibly at the specified interval
  5. Use "Test Movement" button to test a single movement
  6. Click "Stop Simulation" to deactivate

Features:

  • Configurable interval (1-60 minutes)
  • Movement counter
  • Test movement function
  • System tray integration
  • Activity logging

🎯 Common Use Cases

Power API Version

  • βœ… Keeping computer awake during presentations
  • βœ… Long-running downloads or data transfers
  • βœ… Remote desktop sessions
  • βœ… Development builds and compilations
  • βœ… Video rendering or processing tasks

Mouse Simulator Version

  • βœ… 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

βš™οΈ Technical Details

Power API Implementation

SetThreadExecutionState(
    ES_CONTINUOUS | 
    ES_DISPLAY_REQUIRED | 
    ES_SYSTEM_REQUIRED
);

Mouse Simulator Implementation

// 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);

πŸ”§ Development

Project Structure

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

Requirements

  • Framework: .NET 9.0 (Windows Forms)
  • OS: Windows 10/11
  • APIs Used:
    • kernel32.dll - SetThreadExecutionState (Power API)
    • user32.dll - mouse_event (Mouse Simulator)

Building from Source

# Restore dependencies
dotnet restore

# Build in Debug mode
dotnet build

# Build in Release mode
dotnet build -c Release

# Clean build artifacts
dotnet clean

πŸ“ Notes

Important Considerations

  1. 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
  2. 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
  3. General:

    • Both apps respect system tray minimize behavior
    • Activity logs help track when keep-awake was active
    • Always clean up on application exit

System Tray Behavior

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

πŸ›‘οΈ Security & Privacy

  • βœ… No network connections
  • βœ… No data collection
  • βœ… No external dependencies
  • βœ… Open source - review the code yourself
  • βœ… Runs entirely locally on your machine

πŸ“„ License

Β© 2025 - Free to use and modify


🀝 Contributing

Feel free to fork, modify, and enhance these applications!

Ideas for Enhancement

  • 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

⚠️ Disclaimer

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

πŸ“ž Support

For issues, questions, or suggestions:

  1. Check if the issue exists in the code
  2. Review the README for usage instructions
  3. Test with both Debug and Release builds

Made with ❀️ for Windows users who need to keep their systems awake!

About

Two Windows desktop applications designed to prevent your computer from going to sleep or appearing idle.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages