Skip to content

Instantly share code, notes, and snippets.

@smosko
Created November 29, 2023 13:27
Show Gist options
  • Select an option

  • Save smosko/a39ae6c1d41a2c725d9eb4078e687ce2 to your computer and use it in GitHub Desktop.

Select an option

Save smosko/a39ae6c1d41a2c725d9eb4078e687ce2 to your computer and use it in GitHub Desktop.

Revisions

  1. smosko created this gist Nov 29, 2023.
    15 changes: 15 additions & 0 deletions TouchBarFix.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 1. Paste this into Script Editor, replace username and password;
    # 2. Export as "Application", check "Stay open" and "Run-only";
    # 3. Add to Login Items in Settings/General to run automatically;
    # 4. To hide the Dock icon, add to Content/Info.plist:
    # <key>LSUIElement</key>
    # <string>1</string>

    on idle
    set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'") as integer
    if idleTime is less than 58 then
    return 58 - idleTime
    end if
    do shell script "pkill TouchBarServer" user name "*****" password "*****" with administrator privileges
    return 58
    end idle