check macos version before setting alias

This commit is contained in:
zumbiepig 2025-01-02 14:12:58 -08:00 committed by GitHub
parent 9592349083
commit c86610aa41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -17,8 +17,12 @@ function ofd {
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# Reset Launchpad layout (defaults method does not work in MacOS 15.2+)
alias resetlaunchpad='defaults write com.apple.dock ResetLaunchPad -bool true && rm -rf /private/$(getconf DARWIN_USER_DIR)/com.apple.dock.launchpad && killall Dock'
# Reset Launchpad layout (defaults method does not work in MacOS Sequoia and onward)
if [[ "$(sw_vers --productVersion)" -ge 15.0 ]]; then
alias resetlaunchpad='rm -rf /private/$(getconf DARWIN_USER_DIR)/com.apple.dock.launchpad && killall Dock'
else
alias resetlaunchpad='defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock'
fi
# Bluetooth restart
function btrestart() {