Programatically read Automatic Graphics Switching preference?

Customers of an app I work on are having some issues on MacBook Pros with external monitors, which don't occur if the Automatic Graphics Switching is turned off. This is on more recent OS versions (Big Sur, Monterey).

Is there a reliable way to check programmatically if this preference setting is turned on, so the app could at least alert the user?

I've looked at the com.apple.PowerManagement files in /Library/Preferences, however I don't see any key-values in those files changing when I change this setting (tried rebooting system after changing etc.).

Online I've seen some reference to use of the pmset command-line tool to check this however I also do not see its output reflecting any change, and I see conflicting notes on what field might correspond to this setting.

Is there any definitive answer or documentation around this setting?

Thanks in advance!

Programatically read Automatic Graphics Switching preference?
 
 
Q