This project includes a service that detects when Windows wakes from sleep and puts it back to sleep, and a taskbar-resident application that minimizes wake-ups from sleep caused by mouse movement as much as possible.
/MyProject
│
├── /src
│ ├── /WinSleepWell # Project for the Windows (WPF) tray application
│ ├── /WinSleepWellService # Project for the Windows service
│ ├── /WinSleepWellLib # Project for the shared library
│ └── WinSleepWell.sln # Solution file
│
├── /bin
│ └── /Release # Released program contents
│ ├── /App # Windows application
│ ├── /Service # Windows service
│ ├── settings.json # Shared configuration file
│ ├── setup.ps1 # Setup script for Users (Same as the script in the project root)
│ ├── UserGuide.txt # English user guide
│ └── UserGuide-ja.txt # Japanese user guide
│
├── /images # Images used in the project
│
├── .gitignore
├── build.ps1 # Build script
├── setup.ps1 # Setup script for Developers to install and uninstall the service and task
├── README.md # English README file
├── README-ja.md # Japanese README file
├── LICENSE # License file
└── CONTRIBUTING.md # Contribution guidelines
Before running the build.ps1
and setup.ps1
scripts, ensure that your execution policy is configured correctly:
- Open Developer PowerShell for VS 2022 with administrator privileges. You can find this in the Start Menu under All Programs > Visual Studio 2022 > Developer PowerShell for VS 2022.
- Check the current execution policy:
$OriginalPolicy = Get-ExecutionPolicy Write-Host "Current Execution Policy: $OriginalPolicy"
- If the policy is not set to
Unrestricted
, set it using:Note: Setting the execution policy toSet-ExecutionPolicy Unrestricted -Scope CurrentUser
Unrestricted
allows all scripts to run, but you may receive warnings when running scripts downloaded from the internet. Changing the execution policy requires administrator privileges. The author of this project assumes no liability for any issues that may arise from modifying the execution policy. - After completing the setup or build process, if you do not plan to run these scripts frequently, you can revert to the original policy using:
Set-ExecutionPolicy $OriginalPolicy -Scope CurrentUser
To set up the project for development, you can follow these steps:
- Open Developer PowerShell for VS 2022 with administrator privileges.
- Navigate to the root directory of the project.
- Run the build script to compile all projects:
./build.ps1
- After the build is complete, run the setup script to install the service and task:
./setup.ps1 -i
- The built artifacts will be placed in the
bin\Debug
andbin\Release
directories, and the service will be installed and started automatically. - To uninstall the service and task, run:
./setup.ps1 -u
Run Visual Studio with administrator privileges to debug. This program requires administrator privileges.
To build the project, you can use the build.ps1
script. This script will compile all projects and place the artifacts in the appropriate bin
directories.
- Open Developer PowerShell for VS 2022 with administrator privileges.
- Navigate to the root directory of the project.
- Run the build script:
./build.ps1
- The built artifacts will be placed in the
bin\Debug
andbin\Release
directories.
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines on how to contribute to this project.
This project is licensed under the terms of the Apache 2.0 license. See the LICENSE file for details.