Since the artifacts disappear whenever an overlay appears, I solved the issue by creating an app that displays a persistent, invisible overlay:
- Created a new macOS Cocoa App in Xcode.
- Edited the window properties in
MainMenu.xib
, in the attributes inspector, and unchecked "Title Bar", "Shadow", "Close", "Minimize" and "Resize", then in the size inspector I set content size width and height to 1, and initial position x and y to 0.
- Edited
Info.plist
and added a new property "Application is agent (UIElement)" set to YES
.
- Edited
AppDelegate.swift
and changed applicationDidFinishLaunching
to:
window.isOpaque = false
window.alphaValue = 0
window.ignoresMouseEvents = true
window.level = .floating
window.collectionBehavior = [.canJoinAllSpaces, .transient]
- Compiled the app for production with Product > Archive > Distribute App > Copy App.
Now, whenever I want to watch full-screen videos with Night Shift turned on, I can start the application and there won't be any further artifacts. I can then close it from Activity Monitor. Another option would be to have it run at startup (System Preferences > Users & Groups > Login Items).