Commit Graph

149 Commits

Author SHA1 Message Date
Kevin Locke 27df7a9aa7 battery: read status with spaces
According to the [sysfs class power ABI],
/sys/class/power_supply/<supply_name>/status may contain "Not charging".
This is already handled by status_gt() and update() (where ' ' is
converted to '-' for use in config keys) but was not being read due to
skipws.  Read with std::getline() to handle this case.

[sysfs class power ABI]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power

Fixes: #1139
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2022-01-23 18:36:59 -07:00
Amanieu d'Antras 4d067619a8 Fix power calculation when battery units are in μA instead of μW 2021-05-15 15:55:38 +01:00
Max1Truc f3a6e2d494 fix: incorrect battery percentage on Pinebook Pro 2021-05-10 21:00:14 +02:00
Gabe Gorelick 7e13e26c29
[modules/battery] allow format-discharging-full
`format-discharging-full` has been impossible since #923 made it
impossible to be full and discharging at the same time. This should
fix that by only making `format-charging-full` impossible. Whether
or not that should be allowed is a good question, but beyond the
scope of this change.

Fixes #1031
2021-04-25 22:00:24 -04:00
Petri Lehtinen c850212288 Use the correct battery status when multiple batteries are present 2021-03-28 20:07:35 +03:00
Martin Pittermann 3bcf390484 add power to battery formatter 2021-01-24 21:39:14 +01:00
Alex 66e5fda418
Merge pull request #964 from Ocisra/master
Add an option to use battery design capacity
2021-01-18 13:48:03 +01:00
ocisra 0bd96f339e typo 2021-01-18 12:38:02 +01:00
Marek Černoch ce0bf6269b
battery: use timeTo as the default format name 2021-01-18 12:32:51 +01:00
Marek Černoch fdaba72974
Merge branch 'master' into battery-custom-tooltip 2021-01-18 12:22:44 +01:00
ocisra 00046d309d add an option to use battery design capacity as a reference for percentage informations 2021-01-03 15:25:19 +01:00
Pedro Côrte-Real 09c89bcd20 Don't update battery list on every update
Speedup battery state update by only updating the battery list when we
get a CREATE/DELETE event in the directory or whenever we do a full
refresh on the interval.
2020-12-03 09:52:33 +00:00
Pedro Côrte-Real 31a4aff1f8 Don't show battery estimate at 0
If we think we're done might as well not show 0h 0min as the estimate
and just not show anything.
2020-11-27 14:23:37 +00:00
Pedro Côrte-Real 89ca155c43 Support hotplugging of batteries
Refresh the list of batteries on update to handle hotplug correctly.
Probably fixes #490.
2020-11-27 13:56:04 +00:00
Pedro Côrte-Real 908fa2c6c2 Make the battery full-at go to 100%
full-at was capped at the value instead of allowing the battery to show
100% when you were at the full-at value. Uncapping makes more sense as
it makes the full-at value the new 100% and the scale goes down from
there. Whereas before the battery would stay at the full-at value until
it went down enough which is unrealistic.
2020-11-27 11:02:11 +00:00
Pedro Côrte-Real f45d582957 Always mark battery as full at 100%
Since we're now clamping at 100% and rounding, mark as full at that
point. Some batteries will stay in charging state for a long time while
stuck at the same charge level. Just mark them as full to not be
confusing.
2020-11-27 11:02:11 +00:00
Pedro Côrte-Real eb3f4216d4 Show battery state as rounded number
Round the battery charge state so that 99.9% shows as 100%.
2020-11-27 11:02:11 +00:00
Pedro Côrte-Real e0cdcb6e30 Handle charging above 100% gracefully
When calibrating a battery it's possible to go above 100%. Handle that
gracefully by just presenting the battery as full and 100%.
2020-11-27 11:02:11 +00:00
Pedro Côrte-Real a7056f7cce Calculate battery state from just energy values
The energy values are all that's needed to calculate the battery state.
Using other values for the total capacity results in broken results in
some cases. This matches the output of TLP and i3status, while also
being more straightforward.
2020-11-27 11:02:11 +00:00
Marek Černoch 8fb54f47ea battery: allow custom tooltip format 2020-08-19 23:13:03 +02:00
Jannusch Bigge 401ea05dd8 add check that all batteries from type battery 2020-06-16 12:30:21 +02:00
Alex 6ca4e14b29
Feat icons vector (#716) 2020-05-22 21:23:04 +02:00
Alexander Kobel df0d34dbd4 Fix round to 0 or 1 in capacity computation with given full-at 2020-04-21 00:58:17 +02:00
Alex 4a7dd400fe
Merge branch 'master' into on-update 2020-04-12 18:32:19 +02:00
Alex b40cdcb5bd refactor: call parent update 2020-04-12 18:30:21 +02:00
Alex 8e0f3c7ddf
feat: full-at (#649)
* feat: full-at

* fix(man): typo
2020-04-05 16:56:51 +02:00
Alex c8821a5e7f fix(Battery): replace spaces w/ dashes 2019-12-30 13:56:34 +01:00
Alex d40cc6f23a fix(Battery): replace spaces w/ underscores 2019-12-30 13:55:49 +01:00
Jordi Pakey-Rodriguez 0f0765e517 feat(modules): call user on-update if configured 2019-12-05 14:42:36 -08:00
Alex 048d8d328e refactor(Battery): ouput 'Plugged' instead of 'Charging' in the fallback 2019-10-03 09:37:37 +01:00
Benjamin Cheng a63bc84918
Add configurable time display for battery module
Adds a `format-time` configuration for the battery module so that users
can configure how they want their remaining time to be displayed.

The default format remains the same as before, i.e. `{H} h {M} min`,
but users can choose something like `{H}:{M:02d}` to give an output
like `4:29` if wanted.
2019-09-04 14:43:52 -04:00
Alex d24d85bebf refactor: move label name and id to label contructor 2019-05-22 12:06:24 +02:00
Alex 14ace24a26 style(battery): format 2019-05-22 10:09:05 +02:00
Alex 2fa581c7ea fix(battery): multiple paths 2019-05-22 10:06:54 +02:00
Max Reppen cf3cb4c61f feat(Battery) Format argument for time to full|empty 2019-05-21 13:44:05 -04:00
Max Reppen 00ada46dfc feat(Battery) Time remaining on tooltip 2019-05-21 13:36:14 -04:00
Max Reppen 2db81a6107 fix(Battery) "current" unused and removed 2019-05-21 13:35:39 -04:00
Lucas Lazare 51be97f9aa Adding spdlog 2019-05-18 19:44:45 -04:00
Alex 17291dffdf fix(Battery): plugged state 2019-05-17 10:59:54 +02:00
Alex 4b4b74db0c feat(Battery): get icon by state 2019-05-16 17:18:27 +02:00
Jørgen Bele Reinfjell 380fc58f3c fix(battery): change comparison expr. to assignment 2019-05-15 19:19:00 +02:00
Alex 5b3402e110 feat(Battery): plugged status 2019-05-14 15:43:57 +02:00
Alex 92967c7c06 fix(Label): reverse only battery states 2019-05-13 11:36:34 +02:00
Alex 80e9ea746b fix(battery): use path for the / operator 2019-05-12 19:53:22 +02:00
Dan dd0ebe117c chore(cr): cr cleanup 2019-05-03 08:08:55 -04:00
Dan 3bac96945c Revert "feat(percent): adds a percent class to numeric modules"
This reverts commit 82302e58f3b611f7ff6d686d1783b1c32914f7c9.
2019-05-02 22:24:29 -04:00
Dan e158a3e132 feat(states): add generic 'states' to all labels 2019-05-02 22:24:29 -04:00
Dan 472363a623 feat(percent): adds a percent class to numeric modules 2019-05-02 22:24:29 -04:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 83a6475510 feat: can disable tooltip 2019-02-22 11:35:47 +01:00
Alexis de0ee9fcb2 fix(battery): adapter status 2018-12-24 12:17:07 +01:00
Alexis 755fad6bc3 fix(battery): typo 2018-12-24 08:50:58 +01:00
Alexis 87e55ea993 feat(battery): check adapter online as fallback when battery status report unknown 2018-12-24 08:37:10 +01:00
Alexis b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00
Alexis baa7f52e21 refactor(network): wait for new address 2018-11-23 16:04:29 +01:00
Alexis ad7400d5ce refactor(ALabel): add interval 2018-11-23 11:57:37 +01:00
Alexis bd62c4cbc5 feat(Label): use set_markup 2018-11-21 20:49:09 +01:00
Alexis e42fae32ab feat(network): network info interval 2018-11-16 10:02:12 +01:00
Alexis 7222668326 refactor: disable battery timer stop on inotify event for now 2018-11-09 23:02:46 +01:00
Lucas L. Treffenstädt 25f31b19f6 formatting is hard. 2018-11-02 22:50:01 +01:00
Lucas L. Treffenstädt 123ce083b4 fix typo and initialize old_status_ 2018-11-02 22:08:55 +01:00
Lucas L. Treffenstädt 0522577fe5 make status and state fully configurable formats 2018-11-02 22:04:43 +01:00
Lucas L. Treffenstädt b6cad05489 fix formatting 2018-11-02 21:13:57 +01:00
Lucas L. Treffenstädt 9c57df505c Add class for full battery and give option to interpret unknown as full 2018-11-02 19:41:00 +01:00
Alexis 9b201c77d7 feat: battery states && format-full/charging 2018-11-02 11:23:29 +01:00
Robinhuett 4c8621c7a5 Added second warning stage to battery module
Also naming is a bit more consistent
2018-10-30 16:23:36 +01:00
Alexis 3f269ff463 fix: check json::value type 2018-10-26 09:27:16 +02:00
Alexis 9fae5efc06 feat: use interval thread until got inotify event 2018-10-25 17:39:15 +02:00
Alexis 7f1f217d84 feat: multiple config per modules 2018-10-25 17:30:26 +02:00
Alexis 20ff2cab9e
feat(Tray): handle item unregister 2018-09-15 19:01:28 +02:00
Alexis 53956d9d18
feat(ALabel): Toggleable labels 2018-08-27 01:36:25 +02:00
Alexis 0dba3abc1d fix(custom): do not take the custom module ref 2018-08-21 10:50:09 +02:00
Alex 49232eed8d
Clean (#31) 2018-08-20 14:50:45 +02:00
Alexis 8ce33e0c64 fix(window): pick only con title 2018-08-19 20:37:33 +02:00
Alex 6705134034
Handle screens disconnection (#29) 2018-08-19 13:39:57 +02:00
Alexis 27dfffa4e3 refactor: style issue 2018-08-18 15:05:18 +02:00
Alexis b1fd4d7b82 feat(modules): generic label module to allow max-length on all labels 2018-08-18 11:43:48 +02:00
Alex d280f5e8bd
Network detect (#26) 2018-08-17 14:24:00 +02:00
Alex 6635548d3e
Style code (#25) 2018-08-16 14:29:41 +02:00
Alexis a9246a09eb feat(workspaces): add a option to show all workspaces from all outputs 2018-08-15 22:19:17 +02:00
Alexis e3e099f836 feat(workspaces): icons 2018-08-15 14:48:08 +02:00
Alex cee031d2fa
Workspaces scroll event (#19) 2018-08-14 11:26:06 +02:00
Alexis 1555cb71e1 feat(pulseaudio): volume icons 2018-08-13 22:33:07 +02:00
Alexis 68f9ea3065 fix(battery): add check for sys files 2018-08-13 17:11:47 +02:00
Alex a423f7032d
Battery event (#18) 2018-08-13 14:05:13 +02:00
Alexis b381e2a596 feat(battery): capacity icons 2018-08-11 13:15:31 +02:00
Alexis 67fa8bd4c3 style(battery): animates background when battery is in a critical state 2018-08-11 13:03:35 +02:00
Alexis 6ff296a4b0 refactor(bar): prefer standard unique_ptr 2018-08-11 12:49:28 +02:00
Alexis 04183dc696 refactor(modules): prefer sigc::mem_fun 2018-08-11 02:40:13 +02:00
Alexis 2512d51564 fix(gtk): use idle to avoid mutex 2018-08-10 23:21:21 +02:00
Alexis 9b2c551f2e fix(battery): typo 2018-08-10 18:04:48 +02:00
Alexis d728de2dd7 fix(battery): check for battries :( 2018-08-10 18:02:12 +02:00
Alexis 4d3879f26f refactor: avoid useless has_class check 2018-08-10 17:05:12 +02:00
Alexis 03132bd219 feat: add tooltip to battery and memory 2018-08-09 17:30:23 +02:00
Alexis dc4e4860bd feat(config): format modules 2018-08-09 13:30:11 +02:00
Alexis 4cec0f390b fix(battery): proper handle multiple 2018-08-09 11:21:08 +02:00
Alexis b987668f97 style: clean class 2018-08-09 10:50:16 +02:00
Alexis fcb6a9aa8b feat: init repo 2018-08-08 23:54:58 +02:00