2

I am looking for a quick way to make the touchbar go to sleep, without having to wait.

When I use my computer in a dark environment I don’t know how to disable the bright touchbar. I just want to see what’s on the screen, no extraneous information is needed.

2
  • 1
    By sleep the Touch Bar, you want the macOS to keep running and it to go black (or not work at all??) Can you edit your question to clarify, please?
    – bmike
    Commented Dec 27, 2019 at 15:57
  • Not sure if this is possible: see Fully disable MacBook Pro's Touch Bar for some more information.
    – Glorfindel
    Commented Dec 28, 2019 at 7:49

1 Answer 1

1

tl;dr: You can get a shortcut/script/service to revert Touch Bar to work as normal F keys. This is very close to a normal keyboard, with backlight on, in the night.

I used this answer https://stackoverflow.com/a/18752770/10063119 to get the code from the Automator’s “watch me do“.

Open Automator, choose a new “workflow” and keep System Preferences in the dock. Hit the red record button and use System Preferences to disable the fancy Touch Bar and set it to the normal F keys.

Select all steps in the workflow and paste in Script Editor app. Then you can edit it to your need, bind it to keyboard shortcut in System Preferences → Keyboard → Shortcuts. You can also do some modifications to see which mode is active and then decide what action to take. Set the scope of shortcut to “all apps“.

The (unverified, I don't have that model) code is given. You can check and modify as required.

-- Click “System Preferences” in the Dock.
delay 1
set timeoutSeconds to 2.0
set uiScript to "click UI Element \"System Preferences\" of list 1 of application process \"Dock\""
my doWithTimeout(uiScript, timeoutSeconds)

-- Click the “Keyboard” button.
delay 1
set timeoutSeconds to 2.0
set uiScript to "click UI Element \"Keyboard\" of scroll area 1 of window \"System Preferences\" of application process \"System Preferences\""
my doWithTimeout(uiScript, timeoutSeconds)

-- Click the “Keyboard” tab.
delay 1
set timeoutSeconds to 2.0
set uiScript to "click radio button \"Keyboard\" of tab group 1 of window \"Keyboard\" of application process \"System Preferences\""
my doWithTimeout(uiScript, timeoutSeconds)

-- Make a selection from the popupbutton.
delay 1
set timeoutSeconds to 2.0
set uiScript to "click pop up button 1 of tab group 1 of window \"Keyboard\" of application process \"System Preferences\""
my doWithTimeout(uiScript, timeoutSeconds)

-- 10 secs
delay 1
set timeoutSeconds to 2.0
set uiScript to "click menu item \"Expanded Control Strip\" of menu 1 of pop up button 2 of tab group 1 of window \"Keyboard\" of application process \"System Preferences\""
my doWithTimeout(uiScript, timeoutSeconds)

- Click the “System Preferences” menu.
delay 1
set timeoutSeconds to 2.000000
set uiScript to "click menu bar item \"System Preferences\" of menu bar 1 of application process \"System Preferences\""
my doWithTimeout( uiScript, timeoutSeconds )

-- Quit System Preferences
delay 1
set timeoutSeconds to 2.000000
set uiScript to "click menu item \"Quit System Preferences\" of menu 1 of menu bar item \"System Preferences\" of menu bar 1 of application process \"System Preferences\""
my doWithTimeout( uiScript, timeoutSeconds )

on doWithTimeout(uiScript, timeoutSeconds)
    set endDate to (current date) + timeoutSeconds
    repeat
        try
            run script "tell application \"System Events\"
" & uiScript & "
end tell"
            exit repeat
        on error errorMessage
            if ((current date) > endDate) then
                error "Can not " & uiScript
            end if
        end try
    end repeat
end doWithTimeout

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .