Skip to content

Instantly share code, notes, and snippets.

@imax9000
Last active February 26, 2021 15:56
Show Gist options
  • Save imax9000/b41daae3acaf1a4fa9ba9ecba91bbd69 to your computer and use it in GitHub Desktop.
Save imax9000/b41daae3acaf1a4fa9ba9ecba91bbd69 to your computer and use it in GitHub Desktop.
Allow older applications to use dark mode in Mac OS X 10.14 (some may start crashing)
#!/bin/sh
if [ $# != 2 ]; then
echo "Usage: $0 path/to/application.app [on|off|default]" >&2
exit 1
fi
app="$1"
cmd="$2"
set -e
plist_path="${app}/Contents/Info.plist"
bundle_id="$(defaults read "${plist_path}" CFBundleIdentifier)"
# Documentation on the property we're using here:
# https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_app
case "${cmd}" in
on)
defaults write "${bundle_id}" NSRequiresAquaSystemAppearance 0
;;
off)
defaults write "${bundle_id}" NSRequiresAquaSystemAppearance 1
;;
default)
defaults delete "${bundle_id}" NSRequiresAquaSystemAppearance
;;
*)
echo "Unknown command: ${cmd}" >&2
exit 1
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment