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

upower: update percentage defaults #344466

Closed
wants to merge 0 commits into from

Conversation

tlvince
Copy link
Contributor

@tlvince tlvince commented Sep 25, 2024

Description of changes

Current defaults were added in aecfea0, which were in turn based on upstream:
https://gitlab.freedesktop.org/upower/upower/-/blob/28bd86c181e2510ef6a1dc7cfa26f97803698a79/etc/UPower.conf.

Current upstream config:
https://gitlab.freedesktop.org/upower/upower/-/blob/94c91f93f133e23da25a9a7be57db745a30dc5f1/etc/UPower.conf

diff
--- /tmp/old-UPower.conf	2024-09-25 16:57:49.073614746 +0100
+++ /tmp/new-UPower.conf	2024-09-25 16:57:52.676666351 +0100
@@ -59,16 +59,16 @@
 # will be used.
 #
 # Defaults:
-# PercentageLow=10
-# PercentageCritical=3
-# PercentageAction=2
-PercentageLow=10
-PercentageCritical=3
-PercentageAction=2
+# PercentageLow=20.0
+# PercentageCritical=5.0
+# PercentageAction=2.0
+PercentageLow=20.0
+PercentageCritical=5.0
+PercentageAction=2.0
 
-# When UsePercentageForPolicy is false, the time remaining at which UPower
-# will consider the battery low, critical, or take action for the critical
-# battery level.
+# When UsePercentageForPolicy is false, the time remaining in seconds at
+# which UPower will consider the battery low, critical, or take action for
+# the critical battery level.
 #
 # If any value is invalid, or not in descending order, the defaults
 # will be used.
@@ -81,6 +81,13 @@
 TimeCritical=300
 TimeAction=120
 
+# Enable the risky CriticalPowerAction-Suspend
+# This option is not recommended, but it is here for users who
+# want to enable the riscky CriticalPowerAction, such as "Suspend"
+# to fulfil their needs.
+# Default is false
+AllowRiskyCriticalPowerAction=false
+
 # The action to take when "TimeAction" or "PercentageAction" above has been
 # reached for the batteries (UPS or laptop batteries) supplying the computer
 #
@@ -88,7 +95,10 @@
 # PowerOff
 # Hibernate
 # HybridSleep
+# Suspend (AllowRiskyCriticalPowerAction should be true to use this option but risky)
+# Ignore (AllowRiskyCriticalPowerAction should be true to use this option but risky)
 #
+# If Suspend isn't available or AllowRiskyCriticalPowerAction=false, HybridSleep will be used
 # If HybridSleep isn't available, Hibernate will be used
 # If Hibernate isn't available, PowerOff will be used
 CriticalPowerAction=HybridSleep

The rest of the changes are already in #341086.

Things done

Updated option defaults.

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 25, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Sep 25, 2024
@tlvince
Copy link
Contributor Author

tlvince commented Sep 26, 2024

/cc @jtojnar

@jtojnar
Copy link
Member

jtojnar commented Sep 26, 2024

Looks good. The type also changed to include fractional part but it probably does not matter.

But could you please include the context in the commit message (especially the Git revision the change is based on) so that it is available in git blame?

Also please use nixos/upower as the commit tag since you are updating the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants