Skip to content

Instantly share code, notes, and snippets.

@sebastiancarlos
Last active December 10, 2023 16:05
Show Gist options
  • Save sebastiancarlos/ccd53b1391fc21994e722ff5b1823774 to your computer and use it in GitHub Desktop.
Save sebastiancarlos/ccd53b1391fc21994e722ff5b1823774 to your computer and use it in GitHub Desktop.
Everything that you wanted from your macOS status bar, in your terminal! 🀯 Apples never tasted better 🍎
# All my gist code is licensed under the terms of the MIT license.
# EXAMPLE:
# $ sys
# Date Sun Jun 11 10:46 2023
# Battery 21% - charging
# Keyboard Layout Colemak
# Internet name-of-wifi
# battery information
alias battery="pmset -g batt | sed -n -E 's/.*\s([[:digit:]]+%); (.*);.*/\1 - \2/p'"
alias batt="battery"
# date with the format "Mon Jan 01 19:00 2023"
alias date='date +"%a %b %d %H:%M %Y"'
alias time='date'
# show current keyboard layout
alias key="defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | sed -n -E 's/.*\"KeyboardLayout Name\" = (.*);/\1/p'"
# internet connection
# kinda hacky, (shows "Disabled" if wifi is off, shows nothing if not
# connected, network name otherwise)
alias wifi='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | ( grep -E " SSID" || echo "Disabled" ) | sed "s/.*: //g"'
# show date, battery, keyboard layout in a table
alias sys="echo -e \"Date\t$(date)\nBattery\t$(batt)\nKeyboard Layout\t$(key)\nInternet\t$(wifi)\" | column -t -s $'\t'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment