Skip to content

batterymonitor: fix repeated low battery warnings - #1477

Merged
soramanew merged 11 commits into
caelestia-dots:mainfrom
Wekendd:fix/battery-toasts
Jul 23, 2026
Merged

batterymonitor: fix repeated low battery warnings#1477
soramanew merged 11 commits into
caelestia-dots:mainfrom
Wekendd:fix/battery-toasts

Conversation

@Wekendd

@Wekendd Wekendd commented May 14, 2026

Copy link
Copy Markdown
Contributor

Fixes issue #736 (which was closed likely due to inactivity). There was a PR aiming at fixing this (#915) but it was closed for some reason. New behavior:

  • Battery toasts only go off if the current battery level specifically drops to their level (old behavior used to send all toasts that satisfied specified value >= current battery level--this caused multiple toasts to go off at once)
  • When charger unplugged or shell started, sends the closest battery warning toast above the current battery level (if one exists).
  • No reliance on temporary state (not buggy across reloads)

EDIT: Behavior changed below.

@Wekendd
Wekendd requested a review from a team July 23, 2026 03:10
@Wekendd

Wekendd commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Made changes to make this work with the potential of percentage skips (most likely resulting from hibernation). Changes:

  • Battery toasts only go off if the last percent was above their specified level, and current battery percent is now at or below their level
  • Temporary state is reintroduced with a single variable lastPercentage. I couldn't think of any way to do this without using state. However, unlike the old solution (with a flag for each notification level), this implementation works, is clean across reloads/reboots, and only sends the lowest applicable notification.

@soramanew soramanew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@soramanew
soramanew merged commit 55b47eb into caelestia-dots:main Jul 23, 2026
4 checks passed
@Wekendd
Wekendd deleted the fix/battery-toasts branch July 23, 2026 04:56
YashMahawa pushed a commit to YashMahawa/shell that referenced this pull request Jul 23, 2026
* batterymonitor: fix repeated low battery warnings

* fix: battery monitor parameter type

* fix: reintroduce state

I couldn't think of any solution without state to avoid any possible issues with percentage skipping

* fix: run battery warning on startup if under a specified level

* fix: qml lint

* fix: qml linting again lol

* refactor: clean up
DaveLewis360 added a commit to DaveLewis360/shell that referenced this pull request Jul 30, 2026
* upstream/main:
  fix: use GNUInstallDirs for install dirs (caelestia-dots#1762)
  fix: fp precision for nexus
  fix: nominatim compliance (caelestia-dots#1752)
  [CI] chore: update flake
  fix: repeated low battery warnings (caelestia-dots#1477)
  refactor: change IP-lookup API + handle retry on rate limited (caelestia-dots#1734)
  fix: eager load certain services (caelestia-dots#1733)
  feat: add utilities panel confs to nexus (caelestia-dots#1725)
  [CI] chore: update flake
  fix: file system model sorting
  fix: fully round toggled network filter chips
  feat: add saved networks sub page to nexus (caelestia-dots#1722)
  feat: cap networks shown in nexus (caelestia-dots#1719)
  fix: nexus network null warnings
  fix: battery time calc
  feat: nexus VPN section with provider management (caelestia-dots#1605)
  fix: add qtimageformats to nix qs dep (caelestia-dots#1716)
  ci: add nix build workflow (caelestia-dots#1715)
  fix: handle > INT_MAX player lengths overflowing in lyrics (caelestia-dots#1648)
  feat: hidden networks, per-network settings and IPv4 config (caelestia-dots#1604)
  fix: key ZFS filesystems by pool in storage service (caelestia-dots#1673)
  fix: support delayed "xesam:artist" for now playing toast (caelestia-dots#1700)
  fix: preserve unknown config keys on save (caelestia-dots#1675)
  fix: populate pipewire nodes immediately (caelestia-dots#1699)
  fix: launcher action searching (caelestia-dots#1695)
  chore: fix lint warnings (caelestia-dots#1705)
  [CI] chore: update flake
  [CI] chore: update flake
  fix: improve compact tray styling
  refactor: use Item instead of Loader for bar entries (caelestia-dots#1663)
  refactor: improve state handling & add component hooks (caelestia-dots#1661)
  fix: ethernet devices incorrect end rounding
  fix: text field outline outside of widget bounds
  feat: add lock howdy support (caelestia-dots#1515)
  fix: don't animate calendar today indicator
  chore: remove unused Tooltip component
  fix: menu/popup overlays overriding cursor shape
  feat: improve text controls (caelestia-dots#1647)

# Conflicts:
#	modules/bar/Bar.qml
#	modules/bar/BarWrapper.qml
#	modules/bar/components/Tray.qml
#	modules/drawers/ContentWindow.qml
#	modules/drawers/Interactions.qml
#	modules/drawers/Panels.qml
#	modules/lock/NotifGroup.qml
#	services/Players.qml
kongwoojin pushed a commit to kongwoojin/caelestia-shell that referenced this pull request Aug 14, 2026
* batterymonitor: fix repeated low battery warnings

* fix: battery monitor parameter type

* fix: reintroduce state

I couldn't think of any solution without state to avoid any possible issues with percentage skipping

* fix: run battery warning on startup if under a specified level

* fix: qml lint

* fix: qml linting again lol

* refactor: clean up
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.

2 participants