Giter Site home page Giter Site logo

Battery usage support about neofetch HOT 19 CLOSED

dylanaraps avatar dylanaraps commented on May 18, 2024
Battery usage support

from neofetch.

Comments (19)

dylanaraps avatar dylanaraps commented on May 18, 2024

OS X users, what do these commands output?

pmset -g batt | grep -o '[0-9]*%' | tr -d %

ioreg -n AppleSmartBattery -r | grep -o '"[^"]*" = [^ ]*' | sed -e 's/= //g' -e 's/"//g' | sort

Windows users, what do these commands output?

WMIC Path Win32_Battery

WMIC PATH Win32_Battery Get EstimatedChargeRemaining

FreeBSD users, what do these commands output?

acpiconf -i 0 | awk '/Remaining capacity:/ {printf $2}'

acpiconf -i * | awk '/Remaining capacity:/ {printf $2}'

I'm still trying to find the commands for OpenBSD and NetBSD.

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

You can tag me next time for OS X test, I will respond to you much faster.
First one is 100.
Second one is :

    1. AdapterInfo 0
    1. Amperage 0
    1. AvgTimeToEmpty 65535
    1. AvgTimeToFull 65535
    1. BatteryInstalled Yes
    1. BatteryInvalidWakeSeconds 30
    1. BatterySerialNumber XXX (don't want to share)
    1. BootPathUpdated 1454405207
    1. CellVoltage (4090,4112,4085,0)
    1. CurrentCapacity 6014
    1. CycleCount 340
    1. DesignCapacity 6330
    1. DesignCycleCount9C 1000
    1. DeviceName bq20z451
    1. ExternalChargeCapable Yes
    1. ExternalConnected Yes
    1. FirmwareSerialNumber 1
    1. FullPathUpdated 1454421662
    1. FullyCharged Yes
    1. IOGeneralInterest IOCommand
    1. InstantAmperage 0
    1. InstantTimeToEmpty 174
    1. IsCharging No
    1. LegacyBatteryInfo {Amperage=0,Flags=5,Capacity=6059,Current=6014,Voltage=12287,Cycle
    1. Location 0
    1. ManufactureDate 17545
    1. ManufacturerData <000000000702000a038900000XXXXXXXXXXXX (don't want to share)>
    1. MaxCapacity 6059
    1. MaxErr 1
    1. OperationStatus 58435
    1. PackReserve 200
    1. PermanentFailureStatus 0
    1. PostChargeWaitSeconds 120
    1. PostDischargeWaitSeconds 120
    1. Temperature 2943
    1. TimeRemaining 0
    1. UserVisiblePathUpdated 1454421842
    1. Voltage 12287

What are you planing to display? I think it would be nice to display current battery status and then options for cycle count, current capacity & design capacity and also fully charged & is charging.

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

Win 10 git bash:
$ WMIC Path Win32_Battery

Availability  BatteryRechargeTime  BatteryStatus  Caption           Chemistry  ConfigManagerErrorCode  ConfigManagerUserConfig  CreationClassNam                                    e  Description       DesignCapacity  DesignVoltage  DeviceID     ErrorCleared  ErrorDescription  EstimatedChargeRemaining  EstimatedRunTime  Exp                                    ectedBatteryLife  ExpectedLife  FullChargeCapacity  InstallDate  LastErrorCode  MaxRechargeTime  Name     PNPDeviceID  PowerManagementCapabiliti                                    es  PowerManagementSupported  SmartBatteryVersion  Status  StatusInfo  SystemCreationClassName  SystemName       TimeOnBattery  TimeToFullCharge                                    
2                                  2              Internal Battery  2                                                           Win32_Battery                                          Internal Battery                  12112          ASUSXXXXX                                  98                        12312121                                                                                                                                                  XXXXX               {1}                                                              FALSE                                          OK                  Win32_ComputerSystem     DESKTOP-XXXXXX                                                                    

$ WMIC PATH Win32_Battery Get EstimatedChargeRemaining
EstimatedChargeRemaining
9

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

Thanks for the reply and for testing the commands for me!

Currently the battery function prints in this format:

# Single battery
Battery: XX%

# Multiple
Battery0: XX%
Battery1: XX%

# Shorthand Multiple
Battery: XX%, XX%

For now we'll leave battery support at just usage %, I'm getting a laptop for uni in a few weeks so I'll be able dedicate time to implement is charging, current capacity etc properly.

I'll add support for OS X in the morning, it's 2 am here so I'll be heading off to bed. For the Windows output is the 2nd command's output the percentage? It's weird that it's just 9 as the first command shows it as 98.

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

One more thing, what does this output on OS X?

cat /sys/class/power_supply/BAT*/capacity

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

Yeah sry, its 98, just copy/paste things.

Ok great, if I had time I would love to help you, but I have exams those days. Meybe after them if you like.

Nothing, because I can't even cd into /sys like it doesn't exist? The only thing starting on s is sbin.

Sleep well.

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

Is it possible for an OS X system to have multiple batteries in use at the same time?

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

Hmm I am 99% sure that this is not possible but I was just thinking about the new Macbook 12 which has multiple layers or batteries, maybe some info will be different?

But I don't think there will this "multibattery problem" on OS X so don't waste your time implementing this imo.

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

I've added support for Mac OS X and Windows, please test it out when you can @mclado!

The config options are related to multi-battery and won't work on OS X and Windows for now.
To add support for multi-battery output on Windows I'll need to know the command output so I can,
parse it correctly which means that we'll have to wait for someone with a multi-battery laptop to open
an issue.

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

OS X works like it should, check!

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

Awesome!

How about Windows?

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

Nope, something is not ok.

 Disk: 137G / 154G (90%)
 Battery: %

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

I just pushed a fix to master, it should work now.

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

Still not working for me. Using git bash instead of cygwin should't be the problem, right?

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

It shouldn't be an issue as wmic comes with windows, do these commands work on their own?

wmic Path Win32_Battery get EstimatedChargeRemaining /value
wmic Path Win32_Battery get EstimatedChargeRemaining

from neofetch.

ladislavskufca avatar ladislavskufca commented on May 18, 2024

Oh wait a sec, it is! Just found out because I tried manually. I am getting "Invalid GET Expression" (in git bash). But the command in cygwin works well. I can't get this cygwin to work as it should so I could run full fetch script. Running manually lines 1240 - 1245 gives me $ echo $battery 100 100 %

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

I've fixed the doubled usage in my local branch, thanks for finding it.

What about this command in git bash?:

cmd /c wmic Path Win32_Battery get EstimatedChargeRemaining /value

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

I just pushed a fix to master for the doubled battery usage.

from neofetch.

dylanaraps avatar dylanaraps commented on May 18, 2024

If the command above doesn't work in git bash then I'm going to close this issue as it works in CYGWIN.

from neofetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.