[macOS Ventura Regression] ForceToGray no longer works
as a workaround, here is a bit of applescript that toggles the "Color filter" checkbox in the System Preferences
set colorFilterCheck to "Colour filters"
tell application "System Settings"
activate
reveal anchor "Display" of pane "Accessibility"
end tell
tell application "System Events" to tell process "System Settings"
tell window "Display"
tell group 5 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1
repeat until exists checkbox colorFilterCheck
delay 0.01
end repeat
click checkbox colorFilterCheck
end tell
end tell
end tell
tell application "System Settings" to if it is running then quit
And here is an interesting snippet I found that explains how the new color filters can be toggled via code:
// --
// the way things currently work is that the MediaAccessibility functions will set
// preferences in com.apple.mediaaccessibility (relevant to this app are __Color__-MADisplayFilterCategoryEnabled
// and __Color__-MADisplayFilterType) and post the event com.apple.mediaaccessibility.displayFilterSettingsChanged
// in the darwin notification center
// the universalaccessd daemon (/usr/sbin/universalaccessd) listens for the MediaAccessibility preference change
// event. it actually toggles the grayscale filter. it also updates the legacy UniversalAccess preferences that used
// to be used (grayscale and grayscaleMigrated in com.apple.universalaccess - the corresponding event was
// com.apple.universalaccess.screenGrayscaleDidChange in the default distributed notificaiton center, which all apps
// still listen for and so the daemon does post it after toggling grayscale).
// the daemon is not always running or listening for these changes, so we use the following function from
// /usr/lib/libUniversalAccess.dylib to kick it awake after making the changes. (it seems to check and respond to the
// preferences when it is first woken up; wake it up after the changes to avoid potential races)
https://github.com/brettferdosi/grayscale/blob/master/Sources/Bridge.h
I tried to script the preference change with defaults write, but I have no idea how to get the universalaccessd to recognize the preference change from a script / AppleScript. Plus, changing the setting requires "Full Disk Access" :(
@NightMachinery this seems to work for me on an Intel Mac running macOS 14.5. Are you on an ARM mac?
@cmsj I am on an ARM M2 Air.
hammerspoon -c 'hs.screen.setForceToGray(true)'
This doesn't do anything. I am on Sonoma 14.3.1 .