I'm trouble finding a way to disable showing the system battery icon on the menu bar. I can disable it from System preferences -> Energy Saver -> "Show battery status in menu bar", but is there a way to achieve the same with a terminal defaults
command (or using a simple cocoa app)?
You can use the defaults way in terminal to just use this and don't forget to use the killall SystemUIServer or to restart/logout & login.
# Menu bar: hide the Time Machine, Volume, User and AirPort (WiFi) icons
for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
defaults write "${domain}" dontAutoLoad -array \
"/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
"/System/Library/CoreServices/Menu Extras/Volume.menu" \
"/System/Library/CoreServices/Menu Extras/User.menu" \
"/System/Library/CoreServices/Menu Extras/AirPort.menu"
done
defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
"/System/Library/CoreServices/Menu Extras/Battery.menu" \
"/System/Library/CoreServices/Menu Extras/Clock.menu"
killall SystemUIServer
So just move the once you want to hide in the dontAutoLoad array and the ones you wan't visible in the menuExtras array.