Advertisement
Guest User

Untitled

a guest
Dec 19th, 2023
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. #!/bin/zsh
  2.  
  3. # Set the idle time threshold (e.g., 300000 milliseconds = 5 minutes)
  4. idleThreshold=300000
  5.  
  6. # Get the current idle time using ioreg
  7. currentIdleTime=$(ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}')
  8.  
  9. # Compare the current idle time with the threshold
  10. if (( currentIdleTime < idleThreshold )); then
  11.   # System is considered "in use", so open the application
  12.   open -a "YourApplicationName"
  13. else
  14.   # System is idle; do nothing
  15.   :
  16. fi
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement