GithubHelp home page GithubHelp logo

Comments (13)

justinhj avatar justinhj commented on July 28, 2024 1

@FMMazur thank you for submitting this issue.
This relates to #7
This is interesting; I assumed that if a user had multiple batteries it would be okay to show the average, assuming they are all laptop power. But I see that other batteries show up and it makes no sense. I will make an update soon to show only the first battery power.

from battery.nvim.

justinhj avatar justinhj commented on July 28, 2024 1

Yes just updated it this morning. Please grab the latest or set the tag to v.0.5.0 and let me know if it is fixed. The new behaviour takes the first battery found.

from battery.nvim.

FMMazur avatar FMMazur commented on July 28, 2024 1

I found something in MSDN, it says, the device can send the _SUN method as specified on ACPI Reference. So it can be a firmware that don't send that optional method or it could be some driver problem as related at this reddit post.

from battery.nvim.

netfri25 avatar netfri25 commented on July 28, 2024 1

Now it works perfectly!! Thanks a lot, I truly appreciate the effort!

from battery.nvim.

netfri25 avatar netfri25 commented on July 28, 2024

Is there an update on this issue? I have the exact same problem

from battery.nvim.

FMMazur avatar FMMazur commented on July 28, 2024

I believe that the way it is implemented in the commit may not always works, I will check it later.

from battery.nvim.

justinhj avatar justinhj commented on July 28, 2024

I may have to make it either display multiple batteries or pick one based on some criteria. Let me know if you see any documentation on how acpi reports.
Another option, which is less satisfying for the user, would be to have a configurable battery number (take the 1st, 2nd or 3rd and so on)

from battery.nvim.

netfri25 avatar netfri25 commented on July 28, 2024

It still has some issues.
The order of the batteries is not always the same, which makes it sometimes show 0%

Screenshot from 2022-11-19 10-04-41
Screenshot from 2022-11-19 10-04-54

from battery.nvim.

netfri25 avatar netfri25 commented on July 28, 2024

I don't really know how to program in Lua so I have no idea how to implement this, but in /sys/class/power_supply/BAT0/ there is a file called capacity which stores the battery percentage

from battery.nvim.

justinhj avatar justinhj commented on July 28, 2024

@netfri25 thanks for the info. I think the problem with using the file system is that it varies across different linux distributions, whereas the if I require the user to install acpi that levels the playing field. Unfortunately I don't have any idea how acpi orders the batteries so not sure how to pick one.

from battery.nvim.

justinhj avatar justinhj commented on July 28, 2024

I'm going to add a new configuration variable 'multiple_battery_selection'

  1. "max" will choose the battery with the highest percentage power
  2. "avg" will average the battery percentages
  3. 1,2,3... will choose the first, second, third battery reported
    It will default to 1 so the existing behaviour will be unchanged.
    This will initially only be implemented for linux/acpi.

from battery.nvim.

justinhj avatar justinhj commented on July 28, 2024

I've implemented the multiple_battery_selection option in the branch battery-chooser.

battery.setup({
	update_rate_seconds = 30,           -- Number of seconds between checking battery status
	show_status_when_no_battery = true, -- Don't show any icon or text when no battery found (desktop for example)
	show_plugged_icon = true,           -- If true show a cable icon alongside the battery icon when plugged in
	show_unplugged_icon = true,         -- When true show a diconnected cable icon when not plugged in
	show_percent = true,                -- Whether or not to show the percent charge remaining in digits
    vertical_icons = true,              -- When true icons are vertical, otherwise shows horizontal battery icon
    multiple_battery_selection = 1,     -- Which battery to choose when multiple found. "max" or "maximum", "min" or "minimum" or a number to pick the nth battery found (currently linux acpi only)
})

I don't have a linux machine handy to test this on so I'm not ready to push to main, but if anyone can verify that it works and helps with this issue I will do so.

from battery.nvim.

justinhj avatar justinhj commented on July 28, 2024

@netfri25 in your case I would set multiple_battery_selection = max, so that you always get the battery that is charged not the 0%.

from battery.nvim.

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.