Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adriang133/d0b92a349d097e63a1790a0bfd0eeaf9 to your computer and use it in GitHub Desktop.
Save adriang133/d0b92a349d097e63a1790a0bfd0eeaf9 to your computer and use it in GitHub Desktop.
Workaround the HDR bug of macOS Catalina 10.15.4
#!/usr/bin/osascript
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
activate
delay 1
click menu item "Displays" of menu "View" of menu bar 1
delay 1
tell window "LG HDR 4K"
delay 1
if (exists tab group 1) then
click radio button "Display" of tab group 1
set HDRCheckbox to checkbox "High Dynamic Range" of tab group 1
if (exists HDRCheckbox) then
click HDRCheckbox
tell HDRCheckbox
if (its value as boolean) then
delay 15
click HDRCheckbox
end if
end tell
end if
end if
end tell
end tell
end tell
@adriang133
Copy link
Author

@nicolas-martin Added. Thanks for the suggestion! BTW, @lexrus is the original author so the thanks should go to him.

@mhschaap The script is just an automation of toggling the HDR checkbox for convenience. I normally run it every time I wake my laptop up from sleep. Note that if your HDR checkbox is already off when you wake up your MBP, then you need to turn it on and then turn it off again. From doing this lots of times, it seems that you need to wait a few seconds in between, otherwise there's a higher chance it won't work, so the script does just that: turns on HDR, waits 15 seconds, turns it off.

If it's not working for you, then maybe you're closing the settings window before the script gets a chance to finish ?

@lexrus
Copy link

lexrus commented Sep 16, 2020

Hi @adriang133, your script is far more stable than mine. 👍
But I just ended up bought another 4K display without so-called HDR. What a life saving. 😄

@mhschaap
Copy link

mhschaap commented Sep 16, 2020

If it's not working for you, then maybe you're closing the settings window before the script gets a chance to finish ?

Hi @adriang133; it works! I have saved it as an application, moved it to /Applications (sudo) and added it to the login applications. So it starts automatically at login. Could the preferences screen also be closed automatically? click menu item "Displays" of menu "View" of menu bar 1; but then afterwards close?

See ToggleHDRCatalina on the screenshot
Screenshot 2020-09-16 at 21 11 39

Added October 4th 2020:
been using it for quite a while now and in principle it works, however: after completion of the script, I need to power-off the monitor, by the joystick-button and power it on again. Without this action it does not work.
Still I am quite happy with the script! so Thanks!!

@mhschaap
Copy link

mhschaap commented Oct 6, 2020

The script is fine, but still I had some issues left; making a custom EDID file and putting this in /S/L/Displays..../Overrides completely disables HDR; so no script to be run and no flickering. This may interest other readers: https://www.tonymacx86.com/threads/10-15-4-update-how-to-disable-hdr-support.293991

However, if you would like to keep HDR as an option, you should use this script. I don't need HDR. Thanks @adriang133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment