[PR] dylanaraps/neofetch#1945 from EriksRemess - Power adapter information for macOS

Upstream PR: https://github.com/dylanaraps/neofetch/pull/1945
Thanks to @EriksRemess

Co-authored-by: Ēriks Remess <eriks@remess.lv>
This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-07-31 16:28:24 -04:00
commit f48d8b197b

View file

@ -77,6 +77,7 @@ print_info() {
# info "GPU Driver" gpu_driver # Linux/macOS only
# info "Disk" disk
# info "Battery" battery
# info "Power Adapter" power_adapter # macOS only
# info "Font" font
# info "Song" song
# [[ "$player" ]] && prin "Music Player" "$player"
@ -3890,6 +3891,18 @@ get_disk() {
done
}
get_power_adapter() {
case $os in
"Mac OS X"|"macOS")
power_adapter="$(pmset -g ac | awk '/Wattage/ {print $3}')"
[[ "$power_adapter" ]] || power_adapter="not connected"
;;
*)
power_adapter="unknown"
;;
esac
}
get_battery() {
case $os in
"Linux")
@ -5613,6 +5626,7 @@ get_args() {
info "Disk" disk
info "Battery" battery
info "Power Adapter" power_adapter
info "Font" font
info "Song" song
info "Local IP" local_ip