How to restore Dock Icon Badges after killall Dock?

Solution 1:

In order to restore the badges, you need to add this command to your shell script:

defaults write com.apple.systempreferences AttentionPrefBundleIDs 1

...and then tell your script to kill Dock, so the next Dock instance is loaded with the new setting:

killall Dock