Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/zsh
- # Set the idle time threshold (e.g., 300000 milliseconds = 5 minutes)
- idleThreshold=300000
- # Get the current idle time using ioreg
- currentIdleTime=$(ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}')
- # Compare the current idle time with the threshold
- if (( currentIdleTime < idleThreshold )); then
- # System is considered "in use", so open the application
- open -a "YourApplicationName"
- else
- # System is idle; do nothing
- :
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement