I’m changing the .GlobalPreferences NSUserSubstitutions preference through the NSUserDefaults class (through PyObjC, but that’s besides the point).
This preference controls the text substitutions feature (e.g. which can substitute “©” for “(c)”) of OS X.
After changing the preference, I want it to apply immediately in all running apps. When it’s changed through the System Preferences, it applies immediately. How should I signal other apps to apply it immediately?
Update: Here’s the project: https://github.com/ikonst/mac-tex-substitutions
Using the following code:
I was able to detect that the System Preferences application posts a notification named
NSUserReplacementItemsEnabledChangedwhen the text substitutions preferences change.Knowing that, you can now post the adequate notification after changing the preferences to let know all open applications:
Keep in mind that
NSUserReplacementItemsEnabledChangedis not documented anywhere, so this behavior can change any time.