Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Power adapter information for macOS #1945

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -3749,6 +3750,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 @@ -5459,6 +5472,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