Skip to content

Correct way to determine battery percentage icon for the menu tray#119

Merged
actuallymentor merged 2 commits intoactuallymentor:mainfrom
igorkulman:fix/battery-percentage-icon
Mar 26, 2023
Merged

Correct way to determine battery percentage icon for the menu tray#119
actuallymentor merged 2 commits intoactuallymentor:mainfrom
igorkulman:fix/battery-percentage-icon

Conversation

@igorkulman
Copy link
Copy Markdown
Contributor

As mentioned in #105 the way the battery percentage for the menu tray icon is computed is not correct, the issue mentions Display percentage 5 based on 46. The reason for this is that in

image_percentages.sort()
the sort is lexicographical resulting in [0, 10, 100, 15, 20, 25, 30, 35, 40, 45, 5, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95]

This PR fixes #105 using the correct sort and also simplifying the way the percentage is fetched from the sorted array.

@actuallymentor actuallymentor merged commit f601da1 into actuallymentor:main Mar 26, 2023
@actuallymentor
Copy link
Copy Markdown
Owner

Ah very nice one! I'll merge this and deploy in the next version.

@igorkulman igorkulman deleted the fix/battery-percentage-icon branch March 27, 2023 07:59
panoskava pushed a commit to panoskava/battery that referenced this pull request Mar 17, 2026
…centage-icon

Correct way to determine battery percentage icon for the menu tray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Percentage icon not accurate

2 participants