Send notify and run script when system lock/unlock and sleep/wake.
这里有一份中文文档。
- macOS 10.15 or later
- Download DMG file from Releases
- Drop the .app to Application folder
Signature issue
HemuLock is open source software and is safe, but due to Apple's strict inspection mechanism, you may encounter warning interception when opening it.
If you cannot open it, please refer to the Apple manual Open a Mac app from an unidentified developer, or perform local code signing.
Local code signing for macOS
Install Command Line Tools:
xcode-select --installOpen the terminal and execute:
sudo codesign --force --deep --sign - /Applications/HemuLock.app/"replacing existing signature" indicates successful local signing.
HemuLock can listening system events:
- Screen sleep
- Screen wake
- System sleep
- System wake
- System lock
- System unlock
Starting from version 2.0.0, HemuLock supports historical events, and all events will be stored locally. You can view the recent history events through the "Historical Events" menu.
Currently, only viewing the latest 12 historical records is supported.
When the event is activated, HemuLock will take a request to notify servers, support notify is :
If you need other notify, take an issue or try to pull requests. :)
When open Script option, HemuLock can run a script at the same time, the script file located the:
~/Library/Application Scripts/com.ch.hades.HemuLock/script
notice: This is a file, not a folder.
This is a examle to send Pushover notify:
#!/bin/bash
PUSHOVER_TOKEN="xxx"
API_TOKEN="xxx"
push() {
curl -s \
--form-string "sk=$API_TOKEN" \
--form-string "token=$PUSHOVER_TOKEN" \
--form-string "user=xx" \
--form-string "title=HemuLock's Notify" \
--form-string "content=$1" \
https://api.mayuko.cn/v1/push.message
}
case $1 in
SYSTEM_LOCK)
push "System locked"
;;
SYSTEM_UNLOCK)
push "System unlocked"
;;
SYSTEM_SLEEP)
push "System is sleep"
;;
esacCase block is the system event, All arguments type is:
| Event | Argument |
|---|---|
| Screen Wake | SCREEN_WAKE |
| Screen Sleep | SCREEN_SLEEP |
| System Wake | SYSTEM_WAKE |
| System Sleep | SYSTEM_SLEEP |
| System Lock | SYSTEM_LOCK |
| System Unlock | SYSTEM_UNLOCK |
If you don't want to listening system events for a certain period of time, you can take Enable Do Not Disturb open. When the time is in the Do Not Disturb time, no notification will be sent or script no t be execution.
Please modify the Do Not Disturb time setting in Preferences.
| STATUS | INSTRUCTION |
|---|---|
| 🟢 | Runing |
| 🟡 | Do-Not-Disturb Mode |
©MIT
