PowerStatus sound warning

Hoe can we make PowerStatus give us a loud sound warning, for example when the battery reach 10% ?

(can it be done with some command on the terminal?
or
is there a GUI way?)

2 Likes

Don’t know if it already exists, but if not, I think this is a good feature that deserves an enhancement ticket asking for it in dev.haiku-os.org
Please post again here if you eventually create the ticket, so that I can upvote it, I’m also interested in having this feature available as an option.

Oh, I hate that kind of thing, so if you do get it, please make sure that it can be turned on/off by the user… :wink:

2 Likes

Yes, I also find something like that (the sound) helpful !

I’ve come to rely on the sudden slowdown of my MacBookPro CPU / performance when the battery is below 5% (done in hardware, so effects Haiku as well). When I feel the system start to crawl under Haiku, I know its time to seek power source or shutdown. Oddly, this detection method only works in Haiku, on OSX I cannot rely on this since there are so many other interrim system slow downs that you just cannot tell whether its a innefficiency slow down or low battery. Win11 on a poor network is the worst, system freezes for dozens of seconds.

Besides, with low battery you dont want the sound circuits consuming more power to drive the speakers. Ancient mobile phones used to have a “feature” to play the alarm when low battery condition. Sometimes you are far from a recharge point, and the silly 5min repeated alarm would drain the battery sooner.

I work in an embedded space and needed to source adequate power souce for the device I’m working with. Sound circuits added 60W to drive the D/A and amplifier circuits (4Ohm impedance speakers). Laptops have lower spec circuitry, but the power draw is not negligible. In a low battery situation, it may not be wise to draw more power to play a warning sound …

Just my 5c inflated.

2 Likes

The OP asked for a warning at 10%. At this point, it may be a bit early for some but the situation is not critical yet. This said, you’re right, it is not the best moment to play your favourite vids or songs but, in same time, you need to draw user’s attention on the matter before they start an activity that will drain more power. Depending on user and on their current activity a visual alert may not be sufficient.
It’s not the first time that someone ask for that and, there’s probably a script for this purpose buried on the forum. Good luck finding it.

Some years ago in Düsseldorf PulkoMAndy give us a presentation using his x200 if i remember correctly using a projector. Haiku repeatedly shown a low battery warning popup, but he explained us there is a bug somewhere, and it is safe to ignore the warning. I however never seen this kind of popup on my machines.

So in case you also haven’t seen it: the functionality to show a warning is there, so it is a matter of trigger an event and emit a warning sound if that not yet implemented in the source code.
And i should create a ticket about the missing popups on my machines.

This problem has been solved since.

I think the popup is handled by the PowerStatus replicant, do you have that installed? I don’t remember if the trigger is a fixed % of the battery or something determined by ACPI.

It is, if you have two you also get severall popups :wink:

I disagree, for some batteries this is already concerning, 10% is relative to whatever the maximum is, not some gurantee of runtime left :slight_smile:

Keep in mind also that Lithium batteries will age much quicker if you discharge them too far and such.

2 Likes

I think that the event exist and a sound can be assigned to info alerts though I’m not sure that it is actually played.
The problem is that it behaves differently depending of hardware. Some may want a warning at 15% when for others 10% or even 5 % would be sufficient. Also you definitely don’t want a sound if the alert is repeating itself for no reason. This is quite an important feature for laptops and perhaps, this could be implemented differently to have something more adaptable to user needs?

2 Likes

A warning tone, a visual cue, a dimming of the screen brightness (saves energy at the same time) individually or in configurable combination.

1 Like

I don’t know about ACPI, but for PowerStatus it’s here, currently fixed at 15% and not on startup, I think. It seems an easy change for those who just want a sound warning would be to call add_system_event_beep("Battery: low") on initialization and then system_beep("Battery: low") in _NotifyLowBattery so that can be changed in the Sounds preferences, if I remember how the event sounds work.

2 Likes

Can we put that info in a ticket on the bugtracker? Seems like the kind of thing that would be perfect for a ticket marked “(easy)” and recommended to newcomers in Haiku?

3 Likes

https://dev.haiku-os.org/ticket/18322

1 Like

Can the same setting be present in more than one place?
I ask it because I will expect such a setting to be accessed directly trough an entry in the applet’s contextual menu.
But on the other hand it will be logical to be able to acces it also from the Sounds panel, even if the options there are limited to assign a sound.

Hmmm, thinking about it a bit, I imagine an entry in the menu labeled ‘Sound warning…’ that opens a little panel that lets you set the alarm, a slider to set the battery percentage that triggers it (or percentages, maybe you want to charge that battery to just, say, 80%, because you don’t plan to use it for some months), and a button labeled ‘Set sound’ that opens the Sounds panel.

Everything is doable. Adding the sound to the current notification and using Sounds to set the jingle to play seems to be just two lines of code. Adding a menu, making the limits configurable and other stuff would make for some rework of the current app.

2 Likes

Thanks for that!
Ticket already upvoted :grinning: