thebarbican19 / BatteryBoi

The battery app your Mac's been dreaming about behind your back.
https://batteryboi.ovatar.io/
GNU General Public License v3.0
846 stars 20 forks source link

usability - reoccurring low battery notification #49

Open di55er opened 1 year ago

di55er commented 1 year ago

Once my bluetooth keyboard reaches 25% it notifies me of this status - so far so good. However, this notification is reoccurring in short non-configurable intervals (I guess with every check). Since it can take literally days for my keyboard to drain from 25% to 0.. and takes hours to reduce in a single percent, the case of very frequent notifications feel counter productive, irrelevant, and overall bad.

expected behavior would be keep a relevant interval between notifications based on draining estimation or some configurable value, or an option to stop notifications for a selected duration of time etc...

di55er commented 1 year ago

I can suggest (without resorting to a dynamic config setting feature ATM to fix this issue) is to follow one of these suggested logics: Option 1:

  1. Upon low battery notification - store last percentage value per device.
  2. Upon devices percentage check: 2.1. If percentage is less than e.g. 5% trigger notification 2.2. else compare current value with last value to validate a decrease in 2% etc.. to tigger notification.
  3. Upon device charge - clear last percentage stored value.

Option 2:

  1. Upon low battery notification - store current timestamp value in a per-device local storage.
  2. Upon devices percentage check: 2.1. If battery percentage lower than e.g. 5% trigger notification 2.2. else compare current timestamp value with last notification timestamp - And validate an interval of e.g. 5 minutes have passed.
  3. Upon device charge - clear last TS stored value.

*best would be to allow for both option1 + 2, along with a config for which takes precedence. This would also allow a future granular configuration base for user setting.

thebarbican19 commented 1 year ago

Thanks @di55er, you make a valid point here. I have been trying to find an optimal solution here and these are some good ideas. I will work on them for the next update.

di55er commented 1 year ago

If you can share any input, as I didn't really validate any of this against the codebase, I could probably implement these myself as a PR for the changes, as I know this project already takes much of your time. just wouldn't want to work on something for nothing.

thebarbican19 commented 1 year ago

@di55er, I started working on this already as it's needed. Thanks though buddy.

thebarbican19 commented 10 months ago

Hey @di55er, I think I have a solution here (which I will be in v2.5) but it would be great to get your thoughts. I have 2 options, and I think it is a combination of both...

I have a Session ID which is renewed anytime the user logs in or opens from sleep. I am cross-checking this to see if it's different.

Similarly, I am also checking to see if a previous notification was sent (within a 12-hour window).

Let me know your thoughts, this will require testing as each person is of course different.