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

Buggy handling of battery critical action setting by the cinnamon settings UI #11983

Open
Lanchon opened this issue Dec 17, 2023 · 3 comments
Open
Labels

Comments

@Lanchon
Copy link
Contributor

Lanchon commented Dec 17, 2023

Distribution

Mint 21.2

Package version

5.8.4

Frequency

Always

Bug description

the schema for "/org/cinnamon/settings-daemon/plugins/power/critical-battery-action" defines which settings are valid, not the UI.

when this setting is set to some valid values (for example, 'suspend') the UI behaves in this erratic manner:

  • the setting is incorrectly shown as blank in the UI.
  • if you click on the drop-down box, the valid 'suspend' setting is inadvertently changed to anything else.
  • coupled with the immediate updating of the backend, this means that the UI corrupts the current value when an action that should never change a setting is performed by the user (opening the drop-down).

this is, beyond any reasonable doubt, a UI bug.

but there is some backdrop to this story...

i remember reading somewhere that some users were requesting for the ability to set 'suspend' as the critical battery action on their computers, only to be met by draconian answers by devs of the type "you are mistaken! suspend is never ever the right critical action! i will not add that option because i feel the urge to save you form yourselves!"

i could not find that discussion again, though i tried, so i am opening this bug.

to these devs, if they show up, i answer:

  • you are wrong: suspend is the right action sometimes (more on this later), though changing the critical threshold is required for sane behavior in those cases.
  • but if you are going to be draconian and forbid users from doing what they want or need, then at least do it right and do not introduce bugs: you should check if the current value is one of the anointed 'safe' values by those who know better, and if it is not you should avoid corrupting it: either add it now to the values normally populated in the drop-down, or disable the drop-down completely. but fix this buggy behavior please.

i would normally submit a pull request, but not in this case: those who want these restrictions up should maintain this silly code.


finally... this is a bit off-topic, but given the previous threads i read, it seems necessary to explain why 'suspend' is the right critical action in some cases. i suppose there are many, but this is my case:

  • i use a laptop exclusively as a desktop replacement.
  • i need to access this machine remotely.
  • i can only connect this machine to the network via wifi.
  • thus, WoL (wake-on-lan) is not an option, so i need WoWLAN to always work.
  • WoWLAN only works if the system is sleeping. it does not work if it is shut down.
  • again, i need to access this machine remotely. always, no matter what! and i am sometimes away from home for months at a time.
  • it follows that this machine can never ever be powered off. as such, hibernate and hybrid sleep systemd targets are disabled on this machine.
  • normally, on AC power, the battery floats between 70 and 80% SoC (state of charge) to prolong its life.
  • battery low is defined as 60%. critical warning is set at 55%, and critical action is triggered at 50%.
  • so if the lights ran out, the machine will sleep at 50% SoC and will be able to maintain state for weeks if necessary... although power cuts never last more than a few hours.
  • when the power returns, after 30 minutes of known "power good" condition (the laptop battery must be recharged by now), an OpenWrt router will WoWLAN-wake the system and services are finally restored.

i must say i also have the system configured to suspend if inactive for 10 minutes while on battery power, but i have seen this fail sometimes in some setups: some mice sometimes register a fake position oscillation that keeps systems awake (though i think my mouse does not do that). sometimes software just dies. but this is important to me, so i want redundancy in putting the computer to sleep when the power goes out.

@Lanchon Lanchon added the BUG label Dec 17, 2023
@SonicandTailsCD
Copy link

Alright. I'm not a dev, but I can try my best to help you :)

Let me know if you need other help :)

@Lanchon
Copy link
Contributor Author

Lanchon commented Dec 18, 2023

thank you for trying to help, really appreciated.

but the UI is misbehaving, not my setup, because there is (at least) a line of code missing in this section:

critical_options = [
("shutdown", _("Shut down immediately")),
("hibernate", _("Hibernate")),
("nothing", _("Do nothing"))
]

this line should be added:

    ("suspend", _("Suspend")),

however i suspect the devs do not want to add it. (or maybe it was gnome devs that were against it? let's hope.)

thanks!

@SonicandTailsCD
Copy link

Thanks for your comments :)
At this point, a PR is suggested. Try opening one (fork the repo first, modify what you need and then open a PR), explain the same issue and devs should help you. If not, sue their ass!! haha :)
Please let me know how it goes, I want to help you :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants