lock your screen with a PIN while keeping AI agents and background processes running
the problem: macOS/Windows screen locks stop background processes, kill SSH connections, and interrupt long-running tasks
the solution: fullscreen GUI overlay that blocks interaction but keeps everything running in the background
- fullscreen black overlay with PIN unlock
- global hotkey (Cmd+Shift+L on macOS)
- prevents system sleep while locked
- keeps all apps running (AI agents, downloads, compilations, servers)
- works on macOS (Windows coming soon)
- lightweight daemon mode
cargo install --path .or build from source:
git clone https://github.com/louis030195/agent-lock.git
cd agent-lock
cargo build --releasebinary will be at target/release/agent-lock
first time setup:
agent-lock setupenter 4-8 digit PIN (stored as SHA-256 hash)
agent-lock lockshows fullscreen black overlay with PIN input field
- white input box appears in center
- type your PIN and press Enter or click Unlock
- cannot Ctrl+C out while locked
agent-lock daemonruns in background - press Cmd+Shift+L to lock screen anytime
first time setup: grant Accessibility permissions when prompted
- System Settings → Privacy & Security → Accessibility
- add Terminal (or your terminal app) to allowed apps
tip: add to startup items for always-available locking
agent-lock statusshows PIN config status and usage instructions
creates a native GUI window that:
- covers entire screen at highest window level
- captures all keyboard/mouse input
- shows only PIN entry field
- unlocks when correct PIN entered
- macOS: uses
caffeinatecommand - Windows: uses
SetThreadExecutionStateAPI
- PIN hashed with SHA-256
- config stored at
~/.config/screen-locker/auth.json - unlimited unlock attempts (personal use - for stricter security, modify source)
- AI agents: autonomous agents that run for hours/days
- long compilations: rust, c++, large codebases
- data processing: ETL pipelines, ML training
- downloads/uploads: large files, backups
- server processes: local dev servers, databases
- SSH sessions: keep connections alive
- screen sharing: lock screen without disconnecting remote viewers
macOS/Windows screen locks:
- interrupt background processes
- disconnect SSH sessions
- pause some applications
- can't customize unlock mechanism
- no global hotkey support
agent-lock:
- guarantees all processes keep running
- maintains all network connections
- simple PIN unlock
- customizable hotkey
- designed for developers running background tasks
config file: ~/.config/screen-locker/auth.json (macOS)
contains SHA-256 hash of your PIN
cargo test
cargo build --release- Windows implementation
- Linux support
- custom hotkey configuration
- rate limiting for failed attempts
- automatic lock on idle
- multiple monitor support
MIT