macOS service that executes Shortcuts based on screen lock/unlock events.
- Edit
ScreenLockDetector.swiftand update:
static let setOnShortcut = "Your Unlock Shortcut"
static let setOffShortcut = "Your Lock Shortcut"- Run the install script:
./install.sh# View logs
tail -f /tmp/screen-lock-detector.log
# Stop service
launchctl stop $USER.screen-lock-detector
# Uninstall
launchctl unload ~/Library/LaunchAgents/$USER.screen-lock-detector.plist
rm ~/Library/LaunchAgents/$USER.screen-lock-detector.plist
rm -rf ~/Library/Application\ Support/ScreenLockDetector- macOS 15.5+
- Shortcuts configured in Shortcuts.app