12/16/2023 0 Comments Laptop battery trackerMake sure the filtered event list is sorted by date in descending order (latest event first).Type 1 in the event ID text box, then click OK.Select Power-Troubleshooter from the Event sources list.If you're unsure about the right time, pick some value enough in the past. Specify the earliest date and time from which you want logged events.Choose Custom range from the Logged drop-down list.Click Filter Current Log either from the Actions band or the Action menu.Expand the Windows Logs category, and click the System item.Press Win+ R, type or paste eventvwr.msc in the text box, and press Enter.Once you know when the last event was logged right before hibernating and the time you left your laptop, you can do some math to get a rough estimate. When the system is hibernated, the event logger service (and everything else) is stopped after resuming, the event logger service will be started again. For more information about Event Viewer, see What information appears in event logs (Event Viewer)? Event Viewer can be helpful when troubleshooting problems and errors with Windows and other programs. (12.Event Viewer is a tool that displays detailed information about significant events (for example, programs that don't start as expected or updates that are downloaded automatically) on your computer. **In my lenovo, the battery is listed as BAT1, try that too. In that case, you can add this line right before the last line: percent=$((percent + 3)), where "3" is the percentage it's low by. In my case, it seems to be consistently 3% lower than acpi's percentage. I say estimate above because acpi shows 93% battery, and my script shows 90% battery, so try this script against your GUI battery percentage, and see how off it is. Max=$(grep 'design capacity:' info|awk '') (Note, if not already installed, install the program calc from the repo: sudo apt-get install apcalc) #!/bin/bash If you get a "file or directory not found" then this isn't going to work.īut, if it lists files, then here's a script that I just wrote for you that will give you an estimate battery percentage : I was going to suggest acpi but after reading it's not working in 11.10, I had an idea. Or with the distrib's inxi package (more up to date from the inxi official source code here) $ inxi -Bxxxīattery: ID-1: BAT0 charge: 37.4 Wh condition: 37.4/47.5 Wh (79%) volts: 10.8/10.8 model: PA5109U-1BRS type: Li-ion Update your terminal or open new tab or window, and now you can monitor battery charge constantly in terminal ! including tty ! May the scripting be praised !īattery 0: Discharging, 98%, 02:51:14 remainingīattery 0: design capacity 4400 mAh, last full capacity 3733 mAh = 84% bashrc file and add $(batpower) to your prompt. If battery is present, it will show up, if not - the script will tell you so. Then grep POWER_SUPPLY_CAPACITY /sys/class/power_supply/BAT1/ueventĪs always, pay attention to spaces with bash. IMPROVED SCRIPT: Since my original post, I've made a small improvement to the script: #!/bin/bash Replace BAT1 in the above bash code to BAT0 if you have older version Ubuntu i.e. : the batery number may be different for you, in my case it is BAT1, but you can always find it out by cd'ing to /sys/class/power_supply or as Lekensteyn mentioned through upower -e ![]() batpower ) is going to be something like this: POWER_SUPPLY_CAPACITY=23 Grep POWER_SUPPLY_CAPACITY /sys/class/power_supply/BAT1/uevent # Description: Battery charge in percentage Based on the previous answers, I have made a simple script batpower: #!/bin/bash I'm a little late to the party but here's my little contribution. There is also a upower -d ( -dump) command that shows information for all available power resources such as laptop batteries, external mice, etc. bashrc file, and you can type 'bat' any time, in the terminal. Example: alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'Īdd that to the end of your. If you would often like to run that command, then you could make a Bash alias for the whole command. One simple way: piping the above command into grep -E "state|to\ full|percentage" You could use tools like grep to get just the information you want from all that output. upower -i /org/freedesktop/UPower/devices/battery_BAT0Įxample output: native-path: /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0 ![]() ![]() path can be found with the command upower -e ( -enumerate). The below command outputs a lot status and statistical information about the battery.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |