Last active
December 16, 2024 06:17
-
-
Save petrjahoda/f9975cae7d0be03c2fbbc3b4943966b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global computerIsInUse, resetTime | |
on run | |
set computerIsInUse to true | |
set resetTime to (do shell script "date +%s") as integer | |
end run | |
on idle | |
set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF; exit}'") as integer | |
if idleTime is greater than 7.4E+10 then | |
if computerIsInUse then | |
do shell script "pkill TouchBarServer" user name "YourUserNameGoesThere" password "YourPasswordGoesThere" with administrator privileges | |
set computerIsInUse to false | |
end if | |
end if | |
if idleTime is less than 7.4E+10 then | |
set computerIsInUse to true | |
end if | |
set now to (do shell script "date +%s") as integer | |
if (not computerIsInUse) and ((now - resetTime) is greater than 59) then | |
do shell script "pkill TouchBarServer" user name "YourUserNameGoesThere" password "YourPasswordGoesThere" with administrator privileges | |
set resetTime to (do shell script "date +%s") as integer | |
end if | |
return 1 | |
end idle |
on idle
do shell script "pkill TouchBarServer" user name "USERNAME" password "PASSWORD" with administrator privileges
delay 3
end idle
for idle wait 30 seconds before reset, for me fix this method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the great work :) 💯