Last active
January 17, 2026 00:43
-
-
Save emotion3459/cdea08e68671d8858d73b4698a24316c to your computer and use it in GitHub Desktop.
Toggles HDR automatically. Depends on https://github.com/dyphire/mpv-display-plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local function toggle_hdr_display(target) | |
| local hdr_status = mp.get_property_native("user-data/display-info/hdr-status") | |
| if hdr_status and hdr_status ~= target then | |
| mp.commandv("script-message", "toggle-hdr-display", target) | |
| end | |
| end | |
| local function auto_switch(name, value) | |
| if not value then return end | |
| local target = (value == "pq" or value == "hlg") and "on" or "off" | |
| toggle_hdr_display(target) | |
| end | |
| mp.observe_property("video-params/gamma", "native", auto_switch) | |
| mp.register_event("end-file", function(event) | |
| if event.reason == "quit" then | |
| toggle_hdr_display("off") | |
| end | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment