Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: notifications and sound alerts on AC hotplug and low battery #17

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

mmstick
Copy link
Member

@mmstick mmstick commented Apr 5, 2024

My system powered off without any warning, so I've implemented the expected warnings and sound alerts here.

  • Plays sound when entering a low battery threshold (<20%)
  • Plays critical sound alert repeatedly when entering the critical battery threshold (<10%)
    • Unless or until the system's AC adapter is plugged in
  • Plays sound when plugged and unplugged
    • If battery is critical, a critical sound alert begins
    • Unplugging while critical plays power-unplug-battery-low from the Pop sound theme (if the Pop sound theme is installed)
  • Displays notifications for critical and low battery alerts

We should also think about automatically shutting down when the battery reaches a certain threshold to get ahead of any potential file system corruption or data loss.

I've noticed that zbus is behaving very unreliably with AC hotplug events in upower. Messages are received very sluggishly, and often dropped altogether. Seems to also happen in the example of our upower-dbus crate. Listening to /var/run/acpid.socket for AC adapter plug events was more reliable.

Partially improves #18

@mmstick mmstick requested a review from a team April 5, 2024 12:42
@mmstick mmstick merged commit bf2e505 into master Apr 5, 2024
5 checks passed
@mmstick mmstick deleted the ac-plug branch April 5, 2024 14:33
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