auroraa466635
aurora: drop the 80% charge mode, conservation already caps at 80%
+15 −25
4 files changed
- M .config/quickshell/aurora/Battery.qml +7 −13
- M .config/quickshell/aurora/BatteryInfo.qml +1 −2
- M .config/quickshell/aurora/SetPower.qml +6 −9
- M .config/quickshell/aurora/Settings.qml +1 −1
| @@ -9,9 +9,8 @@ import Quickshell.Services.UPower | |||
| 9 | 9 | // switches it without sudo (EnableChargeThreshold, polkit allow_active) but Quickshell's UPower doesn't | |
| 10 | 10 | // expose that, hence busctl. Settings.chargeMode: | |
| 11 | 11 | // off normal charging | |
| 12 | − | // conservation firmware cap on all the time (kept by the EC, works without aurora) | |
| 13 | − | // limit80 aurora turns the cap on at 80% while plugged in (charging stops and the charge is held), | |
| 14 | − | // and off again below 75% or when unplugged. Only while aurora runs. | |
| 12 | + | // conservation firmware cap on all the time (stops at ~80%, kept by the EC, works without aurora) | |
| 13 | + | // (anything else that isn't "off", like the old "limit80", counts as conservation) | |
| 15 | 14 | Singleton { | |
| 16 | 15 | id: root | |
| 17 | 16 | ||
| @@ -41,20 +40,15 @@ Singleton { | |||
| 41 | 40 | setProc.command = busctl(["call", "EnableChargeThreshold", "b", on ? "true" : "false"]) | |
| 42 | 41 | setProc.running = true | |
| 43 | 42 | } | |
| 44 | − | // what the cap should be for the current mode / charge / power source | |
| 43 | + | // keep the firmware cap in line with the setting | |
| 45 | 44 | function evaluate() { | |
| 46 | − | if (!started || !ready || !supported || !hasBat || pct <= 0) return | |
| 47 | − | var mode = Settings.chargeMode, want = capOn | |
| 48 | − | if (mode === "conservation") want = true | |
| 49 | − | else if (mode === "limit80") { | |
| 50 | − | if (!onAc || pct < 75) want = false // unplugged: replugging under 80% charges again | |
| 51 | − | else if (pct >= 80) want = true | |
| 52 | − | } else want = false | |
| 45 | + | if (!started || !ready || !supported || !hasBat) return | |
| 46 | + | var want = Settings.chargeMode !== "off" | |
| 53 | 47 | if (want !== capOn) setCap(want) | |
| 54 | 48 | } | |
| 55 | 49 | ||
| 56 | − | onPctChanged: { evaluate(); checkLow() } | |
| 57 | − | onOnAcChanged: { evaluate(); checkLow() } | |
| 50 | + | onPctChanged: checkLow() | |
| 51 | + | onOnAcChanged: checkLow() | |
| 58 | 52 | Connections { | |
| 59 | 53 | target: Settings | |
| 60 | 54 | function onChargeModeChanged() { root.evaluate() } | |
| @@ -43,8 +43,7 @@ ColumnLayout { | |||
| 43 | 43 | if (root.bat.changeRate !== undefined) | |
| 44 | 44 | lines.push("power draw " + Math.abs(root.bat.changeRate).toFixed(1) + " W") | |
| 45 | 45 | if (Settings.chargeMode !== "off" && Battery.supported) | |
| 46 | − | lines.push("charge limit " + (Settings.chargeMode === "limit80" ? "80%" : "conservation") | |
| 47 | − | + (Battery.held ? ", holding" : "")) | |
| 46 | + | lines.push("charge limit conservation" + (Battery.held ? ", holding" : "")) | |
| 48 | 47 | if (root.bat.healthSupported) | |
| 49 | 48 | lines.push("health " + Math.round(root.bat.healthPercentage) + "%") | |
| 50 | 49 | return lines.join("\n") | |
| @@ -62,21 +62,18 @@ Flickable { | |||
| 62 | 62 | Choice { | |
| 63 | 63 | visible: Battery.supported | |
| 64 | 64 | label: "charge limit" | |
| 65 | − | options: [{ value: "off", label: "off" }, { value: "limit80", label: "80%" }, | |
| 66 | − | { value: "conservation", label: "conservation" }] | |
| 67 | − | value: Settings.chargeMode | |
| 65 | + | options: [{ value: "off", label: "off" }, { value: "conservation", label: "conservation" }] | |
| 66 | + | value: Settings.chargeMode === "off" ? "off" : "conservation" | |
| 68 | 67 | onPicked: v => Settings.chargeMode = v | |
| 69 | 68 | } | |
| 70 | 69 | Text { | |
| 71 | 70 | visible: Battery.supported | |
| 72 | 71 | Layout.fillWidth: true | |
| 73 | 72 | wrapMode: Text.WordWrap | |
| 74 | − | text: Settings.chargeMode === "limit80" | |
| 75 | − | ? "aurora stops charging at 80% (conservation mode on) and resumes below 75%. Only while aurora runs." | |
| 76 | − | : Settings.chargeMode === "conservation" | |
| 77 | − | ? "the firmware's fixed cap, kept even when aurora isn't running. Conservation mode is " | |
| 78 | − | + (Battery.capOn ? "on" : "off") + "." | |
| 79 | − | : "charges to 100%" | |
| 73 | + | text: Settings.chargeMode !== "off" | |
| 74 | + | ? "the firmware stops charging at ~80%, even when aurora isn't running. Conservation mode is " | |
| 75 | + | + (Battery.capOn ? "on" : "off") + "." | |
| 76 | + | : "charges to 100%" | |
| 80 | 77 | color: Theme.dim | |
| 81 | 78 | font.family: Theme.font | |
| 82 | 79 | font.pixelSize: Theme.fontSize - 2 | |
| @@ -91,7 +91,7 @@ Singleton { | |||
| 91 | 91 | property int idleSuspend: 0 | |
| 92 | 92 | property int charTone: 0 // glyph picker emoji skin tone, 0 = none, 1-5 light..dark | |
| 93 | 93 | property bool portalAutoOpen: true // open captive portal login pages in $BROWSER (Net.qml) | |
| 94 | − | property string chargeMode: "off" // off | conservation | limit80 (Battery.qml) | |
| 94 | + | property string chargeMode: "off" // off | conservation (Battery.qml) | |
| 95 | 95 | property int batLow: 15 // low battery warning, % | |
| 96 | 96 | property int batCritical: 5 | |
| 97 | 97 | property string batCriticalAction: "none" // none | suspend | poweroff | |