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
HemuLock can listening system events:
- Screen sleep
- Screen wake
- System sleep
- System wake
- System lock
- System unlock
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"
;;
esac
Case
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