This is a hard problem since the systems do not in fact tell you how it should operate. The problem is that there are several ways to address this issue:
- Apply a LUT to all output
- Let the system color manage
- Let each application color manage
Nearly all of our color management systems are borderline braindead. There is really no sane way to ensure that you are doing the proper thing without extensively testing the system. You can not ask or specify your intent. In case of multi operating system situations. If there is reason for me to color manage something myself im at the mercy of each operating system peculiarities.
For a alternate discussion on this see this stackoverflow poststackoverflow post. But its not really a robust enough talk to cover all cases.