Apple - Disable the sleep function of the macbook touch bar

You can use my script until Apple adds a preference for the Touch Bar.

It simulates keyboard activity by sending the command for the fn-key every 60 seconds. You should not notice it while typing. Keep in mind, however, that this will prevent display sleep / system sleep as well.

Copy and paste the following code into the "Script Editor" application on your MacBook Pro with Touch Bar:

(*
1. Save as an Application: Script Editor > File > Export… > File Format: Application
2. Check "Stay open after run handler"
3. Run the app or add it to your login items: System Preferences > Users & Groups > User > Login Items > Press the "+" button

# http://apple.stackexchange.com/questions/269174/disable-the-sleep-function-of-the-macbook-touch-bar
*)

on idle
    tell application "System Events" to keystroke (key code 63) -- press fn key
    delay 60
end idle

Please let us know if this solves your issue.


As an alternative to oa-'s script (looks great, but I'd rather not forego the display sleep functionality), I searched far and wide for any other solution. I found no complete one, but here's a partial one that might alleviate the worst part of the pain. I find that the single most annoying thing about the disappearing Touch Bar is its effect on the esc key. I use that all the time! Now you have to tap the bar twice: once to wake it up, and then again to press esc. (Or alternatively, press the fn key to wake up the bar, then press esc.)

Here is a way to at least rescue esc functionality by adding it to what remains of the physical keyboard. You can remap the caps lock key to be your esc key. You'll lose caps lock functionality, which is also a drawback, but maybe not as bad as losing esc. (Alternatively, you can remap the control, option, or command key instead.) Go to System Preferences > Keyboard > Modifier Keys, and use the drop downs to choose the action you want.

https://www.imore.com/how-use-esc-key-touch-bar-macbook-pro