Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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
@olafghanizadeh
Copy link

This is just the same as turning off HDR in system preferences though

@BenMorganIO
Copy link

BenMorganIO commented May 26, 2020

@olafghanizadeh it does a little bit more than that. It turns off HDR due to the neon bug. Important because every time the mac goes to sleep, Mac turns it back on. So you have to manually turn it off every time you use your Mac. This script keeps it turned off until the bug is fixed.

@richsark
Copy link

richsark commented Jun 17, 2020

Hi, Love the script. However, how can I get it to run automatically? or if I reboot etc.... lastly, how can I get the box to close after it runs?

@nicolas-martin
Copy link

Thanks for the script, I've been doing these steps manually to fix the resolution. You can also add a shebang on top which makes it a bit easier to run #!/usr/bin/osascript

@mhschaap
Copy link

mhschaap commented Sep 16, 2020

Hi! Haven't tested it yet, but seems great! My LG 4K (27UL850W) is ugly with HDR enabled, but sometimes worse with HDR disabled, this could be the Neon bug? It is like mike656 is describing as "256 colors". https://discussions.apple.com/thread/251213356

This script seems "just" to toggle HDRCheckbox, so it seems indeed the same as toggling it in system preferences, and this does not work for me (sometimes need to toggle 10 times on/off before the 256 colors are gone; after sleep I have 256 colors again)

I would like to understand these problems and the script better. Is there anyone capable of explaining the HDR and 256 color (Neon?) bug and what this script does? Would appreciate a lot!!

BTW, I run 10.15.6; monitor is hooked-up via Displayport on RX580

@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