Skip to content

Commit

Permalink
[PR] dylanaraps/neofetch#1945 from EriksRemess - Power adapter inform…
Browse files Browse the repository at this point in the history
…ation for macOS

Upstream PR: dylanaraps/neofetch#1945
Thanks to @EriksRemess

Co-authored-by: Ēriks Remess <eriks@remess.lv>
  • Loading branch information
hykilpikonna and EriksRemess committed Jul 31, 2022
2 parents c4ff2eb + 0e4f5e5 commit f48d8b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f48d8b1

Please sign in to comment.