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

Commit e4dc2fe

Browse files
committed
Power Adapter info initial support. Only macOS currently.
1 parent 3c961e3 commit e4dc2fe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

neofetch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ print_info() {
7777
# info "GPU Driver" gpu_driver # Linux/macOS only
7878
# info "Disk" disk
7979
# info "Battery" battery
80+
# info "Power Adapter" power_adapter # macOS only
8081
# info "Font" font
8182
# info "Song" song
8283
# [[ "$player" ]] && prin "Music Player" "$player"
@@ -3819,6 +3820,18 @@ get_disk() {
38193820
done
38203821
}
38213822

3823+
get_power_adapter() {
3824+
case $os in
3825+
"Mac OS X"|"macOS")
3826+
power_adapter="$(pmset -g ac | awk '/Wattage/ {print $3}')"
3827+
[[ "$power_adapter" ]] || power_adapter="not connected"
3828+
;;
3829+
*)
3830+
power_adapter="unknown"
3831+
;;
3832+
esac
3833+
}
3834+
38223835
get_battery() {
38233836
case $os in
38243837
"Linux")
@@ -5529,6 +5542,7 @@ get_args() {
55295542

55305543
info "Disk" disk
55315544
info "Battery" battery
5545+
info "Power Adapter" power_adapter
55325546
info "Font" font
55335547
info "Song" song
55345548
info "Local IP" local_ip

0 commit comments

Comments
 (0)