Commit Graph

56 Commits

Author SHA1 Message Date
Stefan Huber ed355dbf46 battery-widget: Sanitize total charge computation
The code to parse the output of `acpi -i` is fragile as it does not
guarantee that the same number of battery status and capacities are
read. This causes a wrong computation of the total charge level when
batteries of status "Unknown" are reported.

For instance, this is what `acpi -i` reports with a Wacom Intuos S
attached to a Thinkpad T460s:

  $ acpi -i
  Battery 0: Unknown, 0%, rate information unavailable
  Battery 1: Not charging, 98%
  Battery 1: design capacity 1857 mAh, last full capacity 1513 mAh = 81%
  Battery 2: Not charging, 98%
  Battery 2: design capacity 2051 mAh, last full capacity 1711 mAh = 83%

Fix the code by guaranteeing that for each battery status parsed there
is also a capacity, which is zero if no capacity can be parsed. This
effectively causes the exclusion of such batteries when computing the
total charge level.
2022-12-30 13:51:04 +01:00
Stefan Huber 0aba2f2e13 battery-widget: Simplify capacity computation
Increase cohesion of code that computes total charge and total capacity.
2022-12-30 12:59:09 +01:00
streetturtle 6ab940db5c
Merge pull request #338 from andreaslongo/issue-209
Fix #209: Match space characters in battery status string
2022-04-15 17:11:31 -04:00
Klimczewski e350548000
No brattery - no pop up
This small change disables popup notifications when the battery is disconnected.
2022-02-22 18:33:36 +01:00
Andreas Longo 51ddb1efba Fix #209: Match space characters in battery status string 2022-02-15 22:10:13 +01:00
GitHub Action 355fd7f9f1 update readme 2022-01-23 21:25:51 -05:00
GitHub Action a6404cada5 update readme 2022-01-23 21:22:00 -05:00
Little Clover d41b54c168 correct valigh -> valign 2021-12-11 09:53:09 +08:00
Barry 700b4e1f55 prevent battery widget from crashing by ignoring null capacity field of Logitech mice 2021-04-26 10:44:05 -04:00
streetturtle 4730492723 [battery] fix #243 2021-03-01 17:24:04 -05:00
streetturtle ed2b256407 fix more warnings 2020-12-06 14:47:40 -05:00
Robert Stoll 0915a81e54
show notification on right click for volume/battery 2020-11-01 22:39:17 +01:00
Chris Bruce 21150bd640 Update readmes to include timeout arg 2020-09-19 01:22:27 -07:00
Chris Bruce a2eddcdfcd Add widget timeouts 2020-09-19 01:08:15 -07:00
Aurélien LAJOIE 92e411da97 Display the notification on the current screen 2020-04-15 19:00:10 +02:00
Simeon Simeonov 60ddaf329b
Make it possible to disable the low battery warning 2020-04-05 11:24:04 +02:00
azhi e6993dd131
fix battery widget
remove extra branch that broke acpi output with 'rate informration unavailable'
same fix as 95cc9b94 (#108) for batteryarc widget
2020-03-26 22:34:46 +03:00
streetturtle c2a7908254 [battery-widget] rename notification parameter to dispay_notification 2020-02-22 13:40:18 -05:00
streetturtle 83376adcfa [battery-widget] make path to the icons customizable (#102) 2020-02-22 13:19:01 -05:00
Pavel Makhov fedea487b6 Check if folder with icons exists, make use of show_current_level 2019-12-24 20:36:44 -05:00
Aurélien LAJOIE faef026d08 Battery: add more parameters and option
Allow to display the value
Add parameters to set the warning message
2019-12-20 01:51:41 +01:00
Aurélien LAJOIE 9bb53077d3 Rework battery_widget adding external configuration 2019-12-20 01:15:34 +01:00
ticktronaut e1b866e237 Fixed buggy spawning of os.time(). 2019-09-02 15:50:05 -04:00
Jakub Podlaha f7a19ff1bc
destroy notification prior making new one
Sometimes the `mouse::leave` signal doesn't make it on time to destroy the old notification properly.
2019-03-26 11:18:21 +01:00
streetturtle 35e2cfdb12 fix battery widget bug when no status was shown due to missing information from acpi 2018-12-25 18:47:25 -05:00
Sam Delmerico 2cf217dc6c merge biased battery levels 2018-11-26 16:21:48 -05:00
Sam Delmerico f369e1cb28 battery is biased on capacities instead of a naive average 2018-11-26 16:19:29 -05:00
streetturtle e55a3ae77a changed '//' to '/' - seems like it was a typo 2018-09-25 17:36:09 -04:00
Sam Delmerico 3d38cdb866 forgot to include update for low battery frequency 2018-06-16 00:39:14 -04:00
Sam Delmerico bfe818b11e battery widgets support multiple batteries
Added support for the battery widgets to read multiple battery values
from the acpi output. The total charge becomes average of all of the
available batteries, the status is that of the highest battery.
2018-06-16 00:20:30 -04:00
streetturtle f9c008dc84
Update README.md 2018-04-01 18:12:59 -04:00
Asger Hautop Drewsen dfe693ce4f
Support one-digit charges in battery widget 2018-03-21 14:07:20 +01:00
pmakhov e6c3059727 Possible fix for the memory leak (issue #11) 2017-12-09 14:39:46 -05:00
streetturtle 06d6055374 Attempt to fix memory leak 2017-12-06 21:07:35 -05:00
streetturtle f70e0ec86b Update README.md 2017-10-13 11:31:18 -04:00
Tommy Mattsson 14c81d51d7 Only show warning if charger is not plugged in 2017-10-09 10:30:03 +02:00
pmakhov 57ccb09844 improve code style 2017-10-05 10:14:02 -04:00
streetturtle df70e598c8 Update README.md 2017-10-04 15:18:51 -04:00
streetturtle d5aed527fa Update README.md 2017-10-04 15:18:17 -04:00
streetturtle bef134560f Update battery.lua 2017-10-04 15:17:58 -04:00
streetturtle dd917a1cb3 Update README.md 2017-09-29 10:15:09 -04:00
streetturtle 41b0476d84 Update README.md 2017-09-29 10:14:03 -04:00
streetturtle 4d7bfe2f76 Update README.md 2017-09-29 10:08:44 -04:00
pmakhov 272410e553 cpu screenshot 2017-09-27 19:46:20 -04:00
Pavel Makhov d86344b1ff Few small improvements for battery widget 2017-06-05 21:17:12 -04:00
Pavel Makhov 4edc315841 Possible fix for memory leak issue #11 2017-04-14 10:02:54 -04:00
streetturtle 42c835616f Update readme 2017-02-08 20:42:54 -05:00
streetturtle c57a059f55 Add naughty.notify alternative 2017-02-08 20:38:13 -05:00
Roman Sokolkov 524e6da88d Refactored popup for battery
Use Awesome tooltip instead of naughty notify

https://awesomewm.org/doc/api/classes/awful.tooltip.html
2017-02-08 19:53:44 +01:00
streetturtle de6cbd7c4a battery: fix icons naming for charing status 2017-02-04 12:57:56 -05:00