Ever arrived home to find your PC occupied at inconvenient hours? Meet The Ruler - a lightweight Python application that automatically locks your computer at specified times, ensuring you maintain control over your PC usage schedule.
- π Automatic computer locking at configurable times
- π Weekday-only operation (automatically disables on weekends)
- πͺ Persistence across system restarts
- π― Minimal resource usage
- β‘ Quick and easy setup
git clone https://github.com/SamuelAMT/the-ruler
cd the-rulerpython -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activatepip install -r requirements.txtStart the application:
start_ruler.bat- The application will run in the background and lock your computer at the specified time (default: 15:25) on weekdays.
- To unlock, enter the password (default: "youaskedforit").
- To stop the application:
python the-ruler-killer.py youaskedforitModify lock_hour and lock_minute in the-ruler.py:
lock_hour = 15
lock_minute = 25By default, the password is stored in plain text for ease of use. However, you can use an environment variable for better security:
import os
from dotenv import load_dotenv
load_dotenv()
class TimeLock:
def __init__(self):
self.password = os.getenv('RULER_PASSWORD', 'default_password')Create a .env file:
RULER_PASSWORD=your_secure_passwordβ
Don't forget to add .env to your .gitignore!
If you're using a virtual environment, update start_ruler.bat to match your venv folder name. Most users create it as venv, but if yours is different, change this line:
call "..\venv\Scripts\activate.bat"to
call "..\my_venv\Scripts\activate.bat"- Important Note: The process is designed to run in the background, making it impossible to unlock the system without entering the correct password.
- If you forget your password: Restart your computer in secure boot mode and follow the instructions in
the-ruler-killer.pyto disable the process.
- Issue: Multiple instances of the application are running.
- Solution: Run
python the-ruler-killer.py youaskedforitto kill all instances, then restart the application.
- Issue: Common startup issues include:
- Virtual environment not activated
- Dependencies not installed
- Missing administrator privileges
- Solution:
- Ensure you've activated the virtual environment
- Run
pip install -r requirements.txt - Run
start_ruler.batas administrator
- Issue: The lock screen might be in an unresponsive state.
- Solution:
- Press
Ctrl+Alt+Delete - Open Task Manager
- End the ruler-background process
- Run the killer script and restart the application
- Press
- Issue: Time synchronization or process issues.
- Solution:
- Check that system time is correct
- Verify the log file at
the_ruler_debug.log - Ensure the application is running (check Task Manager)
Yes, The Ruler is designed with safety in mind. You can always:
- Use Task Manager to close it
- Run the killer script
- Restart your computer
π€ The application intentionally allows these "escape routes" for safety.
Yes, The Ruler persists after system updates and restarts. It will automatically resume its schedule when the computer starts.
Yes, this is intentional. The Ruler is designed for scheduling and routine management, not as a security tool. If you need strict access control, consider using Windows' built-in parental controls.
This is a feature! The Ruler assumes you might want more flexible computer access on weekends. You can modify this in the code if you want different behavior.
Currently, the lock time is set in the code. Future versions may include a configuration file or UI for easier time management.
Feel free to:
- Open issues on GitHub
- Submit pull requests
- Contact the maintainer: [email protected]
- The application runs with administrator privileges to ensure lock screen functionality.
- Password is stored in plain text by default β use the environment variable approach for better security.
- The lock can be bypassed by killing the process β this is intentional for safety reasons.
- If you forget your password, you can secure boot into recovery mode and follow the instructions in
the-ruler-killer.pyto stop the process.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
MIT
This tool is intended for personal use to help manage computer access times. It is not designed to be a security tool and should not be relied upon for critical security purposes.