A little daemon that detect screen sleep and wakeup and triggers shell script(s) to run an action. Here to toggle the power state of a connected Android TV.
Get ADB for MacOS: brew install android-platform-tools
swiftc dimmtrigger.swift
Should create a dimmtrigger
file.
See the trigger.sh
. Edit your absolute path to the adb binary.
Give it exec rights: chmod +x trigger.sh
ln -s /path/to/your/trigger.sh ~/.wake
ln -s /path/to/your/trigger.sh ~/.sleep
Edit line 9 and line 16 to point to your in 1. compiled dimmtrigger
binary and a log textfile collecting errors (line 16).
Place the plist
file in ~/Library/LaunchAgents
folder.
Run in shell: launchctl load ~/Library/LaunchAgents/de.corequip.dimmtrigger.plist
Have fun.