Skip to content

Instantly share code, notes, and snippets.

@luckman212
Created December 29, 2021 22:33
Show Gist options
  • Select an option

  • Save luckman212/312216ad9b9e5d6985dbea47bb70b575 to your computer and use it in GitHub Desktop.

Select an option

Save luckman212/312216ad9b9e5d6985dbea47bb70b575 to your computer and use it in GitHub Desktop.
Enable / Disable / Revert animation-related tweaks to macOS
#!/usr/bin/env bash
function _nl() {
read -r LINE
echo "${LINE:-null}"
}
function _write() {
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
defaults write -g NSScrollAnimationEnabled -bool false
defaults write -g NSWindowResizeTime -float 0.001
defaults write -g QLPanelAnimationDuration -float 0
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write com.apple.dock launchanim -bool false
defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock springboard-show-duration -float 0
defaults write com.apple.dock springboard-hide-duration -float 0
defaults write com.apple.dock springboard-page-duration -float 0
defaults write com.apple.dock expose-animation-duration -float 0
echo ok
}
function _read() {
echo -n 'NSAutomaticWindowAnimationsEnabled: '; defaults read -g NSAutomaticWindowAnimationsEnabled 2>/dev/null | _nl
echo -n 'NSScrollAnimationEnabled: '; defaults read -g NSScrollAnimationEnabled 2>/dev/null | _nl
echo -n 'NSWindowResizeTime: '; defaults read -g NSWindowResizeTime 2>/dev/null | _nl
echo -n 'QLPanelAnimationDuration: '; defaults read -g QLPanelAnimationDuration 2>/dev/null | _nl
echo -n 'com.apple.finder DisableAllAnimations: '; defaults read com.apple.finder DisableAllAnimations 2>/dev/null | _nl
echo -n 'com.apple.dock launchanim: '; defaults read com.apple.dock launchanim 2>/dev/null | _nl
echo -n 'com.apple.dock autohide-time-modifier: '; defaults read com.apple.dock autohide-time-modifier 2>/dev/null | _nl
echo -n 'com.apple.dock autohide-delay: '; defaults read com.apple.dock autohide-delay 2>/dev/null | _nl
echo -n 'com.apple.dock springboard-show-duration: '; defaults read com.apple.dock springboard-show-duration 2>/dev/null | _nl
echo -n 'com.apple.dock springboard-hide-duration: '; defaults read com.apple.dock springboard-hide-duration 2>/dev/null | _nl
echo -n 'com.apple.dock springboard-page-duration: '; defaults read com.apple.dock springboard-page-duration 2>/dev/null | _nl
echo -n 'com.apple.dock expose-animation-duration: '; defaults read com.apple.dock expose-animation-duration 2>/dev/null | _nl
}
function _delete() {
defaults delete -g NSAutomaticWindowAnimationsEnabled
defaults delete -g NSScrollAnimationEnabled
defaults delete -g NSWindowResizeTime
defaults delete -g QLPanelAnimationDuration
defaults delete com.apple.finder DisableAllAnimations
defaults delete com.apple.dock launchanim
defaults delete com.apple.dock autohide-time-modifier
defaults delete com.apple.dock autohide-delay
defaults delete com.apple.dock springboard-show-duration
defaults delete com.apple.dock springboard-hide-duration
defaults delete com.apple.dock springboard-page-duration
defaults delete com.apple.dock expose-animation-duration
echo ok
}
case $1 in
-h) echo "${0##*/} [-w|-r|-d] write/read/delete"; exit 0;;
-w) _write; exit;;
-r) _read; exit;;
-d) _delete; exit;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment