FIX for flashing touchbar

If you want to get rid of the flashing touchbar issue without having to spend a lot of money, try this script.


It will wait until the laptop has been idle for 60 seconds and then kill the touchbar process. This prevents the flashing although one small side effect is that the esc button will flash as the touchbar process tries to restart. Not perfect but definitely a lot better that the bright strobe flashing issue.


Save this AppleScript as and application and choose stay open, add the application to your login items.

You will need to add an admin username and password to the script


global timeBeforeComputerIsNotInUse, computerIsInUse, previousIdleTime

on run
    set timeBeforeComputerIsNotInUse to 60 -- 1 minuteset computerIsInUse to trueset previousIdleTime to 0end run

on idle
    set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'") as number
    
    if idleTime is greater than or equal to timeBeforeComputerIsNotInUse thenset computerIsInUse to false
        do shell script "pkill “Touch Bar Agent”" user name "" password "" with administrator privileges
    end if
    
    set previousIdleTime to idleTime
    return 1end idle

MacBook Pro 15″, macOS 12.0

Posted on Nov 5, 2021 4:05 AM

Reply

Similar questions

1 reply

Nov 5, 2021 5:00 AM in response to Kevin Neal

Improved version


global timeBeforeComputerIsNotInUse, computerIsInUse, previousIdleTime

on run
	set timeBeforeComputerIsNotInUse to 60 -- 1 minute
	set computerIsInUse to true
	set previousIdleTime to 0
end run

on idle
	set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'") as number
	
	if not computerIsInUse then
		if idleTime is less than previousIdleTime then
			set computerIsInUse to true
			do shell script "defaults write com.apple.touchbar.agent PresentationModeGlobal -string appWithControlStrip"
			do shell script "pkill “Touch Bar Agent”" user name "" password "" with administrator privileges
		end if
		
	else if idleTime is greater than or equal to timeBeforeComputerIsNotInUse then
		set computerIsInUse to false
		do shell script "defaults write com.apple.touchbar.agent PresentationModeGlobal -string app"
		
		
		do shell script "pkill “Touch Bar Agent”" user name "" password "" with administrator privileges
		
	end if
	
	set previousIdleTime to idleTime
	return 1
end idle

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

FIX for flashing touchbar

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.