75 comments

  • LeoPanthera 8 hours ago

    A huge advantage of AlDente over this is the "sailing" feature. I have mine configured to stop charging at 80%, but then only start charging again when it drops to 50%. It's ideal for preventing lots of very short charging sessions. (This is also an ideal pattern for charging EVs.)

    It also has a "calibrate" feature which goes through a 100 -> 10 -> 100 cycle which teaches the battery firmware what the actual capacity is now. Useful to run every month or two.

    My Air battery is three years old and has 99% health because of using these features.

    • userbinator 5 hours ago

      Dells have had this feature built into their BIOS for many years: https://forum.endeavouros.com/uploads/default/original/3X/4/...

      That's right, in the BIOS - it's independent of the OS being run, or indeed if there is any OS at all (which is the case if the machine is turned off and charging.)

      • rahimnathwani 5 hours ago

        My son's Lenovo laptop, bought from Costco, also has this feature.

        • userbinator 3 hours ago

          In the BIOS? From what I've read, Thinkpads at least need a driver and utility to set the discharge/charge thresholds.

          • rahimnathwani 3 hours ago

            Yes, I don't have it to hand, but I'm pretty sure the charge limit even works when the laptop is shut down.

            It's not a ThinkPad, but an IdeaPad Slim 5i i7-1355U touchscreen.

    • rahimnathwani 5 hours ago

      I have a crontab that checks the battery status every 5 mins. If the battery level is lower than 60%, it turns charging on. If it's higher than 80%, it turns charging off.

      Of course, this doesn't help if you happen to turn the laptop off before it reaches 80%. In that case, it will charge all the way to 100%.

    • mrheosuper 6 hours ago

      I use AlDente, but notice if i left my machine charge overnight, it still charges over my set limit(for example, i set at 80%, but in the morning i see my machine at 87%)

    • latchkey 8 hours ago

      The cli docs say this:

        battery calibrate
          calibrate the battery by discharging it to 15%, then recharging it to 100%, and keeping it there for 1 hour
      • LeoPanthera 8 hours ago

        Well that's good. AlDente can automatically schedule it, which is convenient.

  • js2 10 hours ago

    The FAQ answers why this exists when macOS has a similar built-in feature:

    > Optimized Charging, a feature that is built into MacOS, aims to ensure the longevity and health of your battery. It does so by "delaying charging the battery past 80% when it predicts that you’ll be plugged in for an extended period of time, and aims to charge the battery before you unplug," as explained in Apple's user guide.

    > Additionally, Optimized Charging uses machine learning to decide when the battery should be held at 80%, and when it should become fully charged. If your Mac is not plugged in on a regular schedule, optimized charging will not work as intended.

    > This app is a similar alternative to Optimized Charging, giving the user control over when it is activated, what percentage the battery should be held at, and more.

    • cnst 8 hours ago

      We've literally had configurable charge levels on ThinkPads since the time they were still owned by IBM over 20 years ago, yet Apple still can't figure out to provide such an option 20 years later?

      Their whole ML thing is super annoying. Basically, it means you can never disconnect your Mac from your USB-C monitor, lest it immediately charge to 100% upon a reconnect, and discharge back to 80% only a few days after keeping it at 100%.

      • diebeforei485 5 hours ago

        I unplug a couple times a week and does not charge to 100% each time I reconnect.

        I know the non-deterministic nature of this can be frustrating, but it actually has to charge to 100% every now and then in order to calibrate.

      • userbinator 6 hours ago

        yet Apple still can't figure out to provide such an option 20 years later?

        I have a few Dells several years old which have the same feature. The difference is that Apple prefers to control you, rather than the other way around.

    • bearjaws 9 hours ago

      Yeah I have found my MBP at 100% far too often, every now and again I peak and it says "holding charge".

      I don't leave my laptop plugged in 100% of the time, however it is plugged in ~70% of the time and I never discharge it that much when it is unplugged. So this little app is perfect for me.

      Seems Apple still has work to do on their algorithm, it could easily keep it at 80% and I would never get below 20%.

      • varenc 9 hours ago

        I have the same frustration. The built in Apple algorithm is far too conservative. The `batt` tool has solved this for me now.

        iPad OS on recent iPads has a dead simple "limit charge to 80%" option in system settings. MacOS should just have the same feature.

        I also limit my iPhone's charge by using shortcut automations and a smart power plug. It just turns the plug off when charge exceeds 80% and on when it drops below 75%. Not ideal but I think still better for battery life than having it sit at 100%. (lmk if I'm wrong!)

        • jerrysievert 6 hours ago

          > iPad OS on recent iPads has a dead simple "limit charge to 80%" option in system settings. MacOS should just have the same feature.

          is the optimized battery charging option in settings that tells you that it will charge to 80% and learn when it needs to charge to 100% not that? it seems to be exactly what you're looking for? it's pretty consistent across all 4 platforms: macOS, iOS, iPadOS, and watchOS, they all offer the same feature

        • AnonC 5 hours ago

          > I also limit my iPhone's charge by using shortcut automations and a smart power plug. It just turns the plug off when charge exceeds 80% and on when it drops below 75%. Not ideal but I think still better for battery life than having it sit at 100%. (lmk if I'm wrong!)

          For battery longevity, I’ve seen recommendations that the lithium ion battery should be allowed to discharge, and that between 40% and 80% is a good range to keep it in. I’m unable to find the link, but I’ve also seen a more recent (like in the last few years) recommendation that 35% to 75% is better.

          Your choice to start charging it at 75% doesn’t seem ideal with any of the recommendations over the last several years.

      • dangus 6 hours ago

        I switched to a framework laptop, where this is easily configured.

        But then I didn’t configure it anyway because my battery is user-replaceable and costs $70 so I happily charge and discharge it however much I want.

        Just wish it had Apple-level battery life.

    • p1necone 8 hours ago

      Sounds annoying, I would much rather just have it be configurable.

  • CjHuber 9 hours ago

    I'd rather have a tool that degrades my battery to below 80% max capacity so that I can get a free new one from apple care+

    • sigmoid10 9 hours ago

      I'd rather have that new EU rule that mandates laptops and smartphones to have easily user-replaceable batteries by 2027.

      • Aurornis 6 hours ago

        I’d rather not pay the price of reduced chassis stiffness (from the opening), increased weight, increased cost, and increased size, however small.

        Replacing the battery is a once every 4-5 years thing for me, if that. Optimizing the entire laptop around a one-time activity that I can pay Apple to do for me for $250 (OEM quality battery included) feels backward. Give me the stiff chassis and reduced complexity of a built-in battery.

        • sigmoid10 an hour ago

          That's just your average astroturfed marketing spin from affected companies. There are quality phones out there with good chassis (including IP68 waterproof) and replaceable battery. In fact we'd already come a long way with phones that don't require melting of glue and special one-time tools to open or remove the battery. That's literally just manufacturers trying to squeeze their customers with expensive (and exclusive) repair contracts. And since Apple already overcharges the base devices by a lot, they'd still make a ton of money after the rule goes into effect (unlike certain other brands).

      • JoshTriplett 7 hours ago

        I love the concept of being able to replace a battery. I don't love it enough to lose the option of buying a thinner, lighter, IP68-waterproof phone.

        • toast0 7 hours ago

          I had a samsung something from work that had a user replacable battery and claimed water proof (not sure about the IP rating though). It seemed thin and light enough to me.

          Edit: it must have only claimed water resistant... Lining up the accesories, I think it was a Samsung Galaxy S6 Edge, which people say tests good in a bowl of water for about 20 minutes. That's a lot longer than I'd leave a phone in a bowl of water, so seems good enough to me?

          • vladvasiliu 33 minutes ago

            Don't know about the S6, but I used to have an S5 which I used as a GPS on a motorbike. Strapped to the bars, no housing at all. Never had any problem with it under pouring rain.

        • dangus 6 hours ago

          When the EU mandates this it’ll be the fastest eating of your words anyone’s ever seen.

          All of a sudden trillion dollar smartphone companies will magically have the engineering talents to produce a waterproof and thin phone with a replaceable battery.

          I dunno guys do you think a company that designed a mobile phone chip with 20 billion transistors in it can make a battery door with a gasket?

          • JoshTriplett an hour ago

            If that engineering talent is readily available, please by all means build the Framework of phones. I would love to buy it. You don't need regulations to do that, if there's sufficient demand.

            • sigmoid10 35 minutes ago

              The engineering talent to build supersonic planes or moon rockets also was readily available. But that doesn't mean that they were viable business strategies for profit-maximizing companies. Sometimes engineering better products has to come from government mandates, not c-suite mandates.

        • LoganDark 7 hours ago

          A replaceable battery doesn't have to make the phone thicker, heavier, or less waterproof if implemented correctly. For example, you could hold the back glass to the phone using mounting pressure rather than permanent adhesive. You could also hold the battery to the inner casing using mounting pressure rather than permanent adhesive. The weight difference is negligible. Congratulations, the battery is now replaceable.

          • Aurornis 6 hours ago

            > A replaceable battery doesn't have to make the phone thicker, heavier, or less waterproof if implemented correctly

            A replaceable battery will reduce the water resistance by adding more possible water ingress points. There is no question about this.

            It will increase thickness because you need a wall between the battery compartment and the device now.

            It will add weight and thickness because the battery cover is now a separate piece and can’t contribute as much to the structural rigidity of the chassis.

            Thinking that a device could have a removable battery with no downsides is fantasy.

            • LoganDark 16 minutes ago

              Weird that you think a replaceable battery needs a separate cover and compartment? The entire point of my comment is that you can just make the existing thin and light phone openable.

          • icehawk 5 hours ago

            If it didn't have to make the phone thicker, heavier, or less waterproof if implemented correctly why isn't it currently an option?

          • jbhifilover 7 hours ago

            Mounting pressure? As in, apply constant pressure to a thin piece of glass that is already prone to being dropped and broken? Am I misunderstanding or is this a terrible idea?

      • bdangubic 9 hours ago

        in US there is a better chance of a mandate that requires you to buy a new laptop every 17 days :)

    • unfocused 9 hours ago

      Agreed! I have a 2020 Macbook Air (Apple Silicon) and it's been at 81% for about a year. Heck, it's now at 82% according to System Information, but Coconut Battery says 77.4%. Not sure which is correct any more, and if Apple is doing some funny business. Battery cycle count is at 845, with a manufacture date of 2020-10-05. So 1,770 days old.

  • adastra22 7 hours ago

    Serious question: why would I want to do this? In order to prevent my battery from degrading and maybe having 80% its max charge level after some years of use... I'll proactively never operate at more than 80% charge? How does that make sense?

    • gruez 6 hours ago

      Most of the time you don't need 100% of your battery capacity (eg. at home/office), so charging it to 100% degrades it faster but doesn't provide any benefit. Obviously if you actually need the capacity (eg. you're going on a flight), you'd disable the limit.

      • adastra22 32 minutes ago

        Most of the time I do. I don’t leave my laptop plugged in. I use it until it needs a charge, plug it in until it is full, then unplug again. I’m usually not near a charger, so I am actually needing that battery to work.

        Maybe this is why my experience is different than most here?

        Still, even after 5 years of doing this, my battery life remains within 80% of its original state.

    • userbinator 7 hours ago

      The degradation-to-charge-percentage curve is highly nonlinear for lion cells. This is why in applications such as aerospace and EVs, they are derated from their original capacity and last much longer.

      • kccqzy 6 hours ago

        This derating is actually really easy to implement: a standard lithium ion cell is actually fully charged at 4.2V, but the battery management system will report it as fully charged once it reaches 4.15V or so.

    • achierius 7 hours ago

      "and maybe having 80% its max charge level"

      It's much worse than this. One year can be enough for a 20% drop like that, and it's not impossible to go even lower. Think 50% or worse after 'some years' of aggressive use.

      • mikepurvis 6 hours ago

        Anecdotally this feels like what happens with phone batteries. Apply tells me my battery is at 80% health, but when it's half dead by lunchtime, I'm pretty sure I'm getting more like 50-60% of the original life out of it.

        • gruez 6 hours ago

          This is probably confounded by the impact of worse optimized software as time goes on, because apps expect faster and more energy efficient chips.

    • aunty_helen 6 hours ago

      Neuroticism. Tech people suffer from this condition and need to tinker. Rather than just replacing a well used battery they’re going to spend a lot of mental energy worrying about 15 minutes of charge degradation that apparently they don’t need anyway.

      • adastra22 4 hours ago

        The only answer here that makes sense. Thanks.

    • mrheosuper 5 hours ago

      Lithium Battery hates being at full state for a long time, that's why when buying new phone/laptop, the SOC you see will never at 100%, usually at 60-70%.

      Many people leave their laptop plug most of the time, so this harms battery.

  • crazygringo 8 hours ago

    I'm baffled as to why new iPhones and iPads have a settings toggle to only ever charge to max 80%, but Apple hasn't brought the same setting to new Macs, so you still need a third party tool like this. Especially after unifying the Settings app!

    Also this tool (or Al Dente) still isn't perfect -- if you shut your Mac off for any reason while keeping it plugged in, it will immediately charge back up to 100%. The third party charge limit only limits charging when the Mac is on or sleeping, not off entirely. (Granted, not many people turn their Macs entirely off these days.) So while I love the third party solutions, a native Apple solution would be even more reliable (plus the built-in Apple solution on iOS automatically charges to 100% occasionally just to keep the battery level accurate -- it's pretty smart).

    • jerrysievert 6 hours ago

      system settings -> battery -> battery health (i)

      choose "Optimized Battery Charging". seems to be exactly what you're looking for

      • mrheosuper 5 hours ago

        Not the same. If your charging pattern is unpredictable, that setting will be absolutely useless.

        • jerrysievert 5 hours ago

          I have it turned off on my MacBook Pro, but on for my phone and iPad. my 4 year old macbook pro's battery is doing great, my iPad is still holding on (but it spends a lot of time unplugged or powered down), but my poor phone is hurting badly (4-6 hours of charge per day, claiming it's at 80% battery life).

          my MacBook Pro still thinks its battery is awesome, even plugged in all the time.

    • leptons 8 hours ago

      >I'm baffled as to why new iPhones and iPads have a settings toggle to only ever charge to max 80%, but Apple hasn't brought the same setting to new Macs

      Because that would affect their battery life ratings, making them close to most other laptops.

      • crazygringo 8 hours ago

        I don't follow. It wouldn't change ratings at all. It's an optional toggle that defaults to off. For this reason it doesn't affect battery life ratings on phones or tablets either.

    • Aurornis 6 hours ago

      > I'm baffled as to why new iPhones and iPads have a settings toggle to only ever charge to max 80%, but Apple hasn't brought the same setting to new Macs,

      It’s called “optimized battery charging” and it’s been in macOS for a long time.

  • varenc 9 hours ago

    I use this project which does the same thing: https://github.com/charlie0129/batt

    and they recently added a basic GUI as well.

  • aaronscott 9 hours ago

    This is awesome!

    Thanks for explaining the reasoning behind implementing your own version instead of using Al Dente. The straightforward UI is really appealing.

    I paid for an Al Dente license long ago and have been very happy with it, sail mode and temperature sensitive charging are great features (although I’m not sure how big of an impact sail mode makes).

    It’s great to see alternatives available though. Having command line access is really cool.

    • duskwuff 7 hours ago

      > although I’m not sure how big of an impact sail mode makes

      Anecdotally: I've used sailing mode for the last year or so, and almost always use my laptop on AC power. Before I started using sailing mode, my cycle count was 120; now, a year later, it's 123.

  • twilo 6 hours ago

    I don’t know why everyone is concerned about the top end of the these batteries when we should be limiting depth of discharge instead, which causes way more damage than charging to 100%.

    There should be an option for the machine to pretend like 40% is 0% and just go to sleep.

    I know Windows has this option but it’s deep inside the power settings, they should bring it out of there.

    I don’t think Apple devices have anything like that.

    • vladvasiliu 22 minutes ago

      Because that's easier to control. In my case, I rarely use my laptops on battery, and when I do I tend to keep an eye on the battery level. If I have to use it till empty, it's because I'm actually doing something that needs to be done, so too bad for the battery life. If I'm randomly browsing HN, I'll stop around 20-30% and go do something else.

      With charging, I can't plug and unplug my screen every 5 minutes just to keep it around 80%.

    • userbinator 3 hours ago

      The research I've found shows far more degradation at high SOC than low.

  • pulvinar 13 hours ago

    I could swear my MacBook Air M3 was limiting at 80% charge before, but now it's at 100%. I suspect that the latest OS update, 15.6, disabled or removed whatever was limiting it, but I don't remember what that was.

    It doesn't look like I had installed this "battery" command. It might have been AlDente, but I don't find that anywhere either.

    A puzzler.

    • catgirlinspace 9 hours ago

      Could’ve been the built in optimized battery charging where it stays at 80% until about when it think it’ll be needed (based off of previous usage on battery tmk, but i wouldn’t be surprised if it also looks at the native calendar app or something too) at which point it charges to 100%. Apple has been doing it for years on iPhones and i think it was introduced on Mac when Apple silicon happened.

      For me my MacBook stays at 80% through the evening and night before charging to 100% in the morning when I typically unplug it and put it in my bag. If you open the battery thing in the menu bar it shows when it’s doing this, the time it’s scheduled to be finished charging by, and has a little button to charge to 100% immediately.

    • Reason077 9 hours ago

      macOS has a built in "smart" battery management feature ("Optimize battery charging" in system settings -> battery -> battery health) that limits charging to 80% during times when it expects you to have the MacBook plugged in, but charges automatically to 100% when it thinks you'll be using battery power.

      It's unreliable, however, especially if you don't have your MacBook plugged in on a fixed schedule every day.

      It's good that there are more third-party tools to work around this long-standing macOS deficiency. I've been using another one, called "Battery Toolkit", which has been working well.

      • cnst 8 hours ago

        macOS is unreliable period; mine gets charged to 100% immediately after a power outage of any kind, e.g., re-arranging the monitor/laptop, or an actual power outage.

        Obviously, it'd be nice if it knew of power outages upfront, but charging to 100% after one, is kinda pointless.

        Then it stays at 100% for several days, until discharging to 80% several days later.

        It's supposed to be smart, but instead it causes the user to alter their own behaviour, e.g., not disconnect the USB-C when rearranging the desk, even if disconnecting would be far more convenient when doing a cleanup or re-arranging furniture.

        I miss the time when Apple used to give you choices…

      • v5v3 8 hours ago

        As said, latest OS does have a smart 80% limit built in. It's hard to find though (have to click the i for information in battery section).

    • Someone 9 hours ago

      Apple claims Optimized Battery Charging “will delay charging past 80% in certain situations” (https://support.apple.com/en-us/102338)

      That page also says “On Mac computers with Apple silicon or the T2 security chip, Optimized Battery Charging is on by default when you set up your Mac or after updating to macOS Big Sur or later.”

      Maybe, you or a system update switched off that setting? Alternatively, the logic behind that setting may have ‘decided’ that you need 100% charge now (I think this setting isn’t just a “limit charging to 80%” flag, but tries to predict future power demands)

    • wslh 10 hours ago

      I have a MacBook M1 Max that I mainly use as a desktop, and it seems to automatically limit the charge from time to time. It is connected to a Caldigit TS4 Thunderbolt Dock, and charging via USB-C. I don't think this make any difference but giving the detail for more information about the setup.

  • amluto 6 hours ago

    This is:

    a) really neat.

    b) an utterly terrifying wrapper around a wrapper around this:

    https://github.com/hholtmann/smcFanControl

    See here:

    https://github.com/actuallymentor/battery/tree/main/dist

    The layer above that is a shell script that downloads and runs shell scripts from github and calls visudo. The layer above that is an electron app that execs the shell script.

    I used to be a happy user of bclm, but that doesn’t work any more, sadly. I’ll keep looking for a good option.

  • Perepiska 3 hours ago

    "M32" typo issues (x3) are unfixed for 9 months and make my eyes twitch.

  • wingworks 9 hours ago

    Perfect, just was I've been looking for. Thanks!

  • neves 7 hours ago

    I really hate this feature in my Microsoft Surface. It try to guess when it does not need to full charge to preserve the battery.

    But then I can't tell it: now charge to 100% because I'll travel and need a full charge.

    Stupid.

  • frumplestlatz 7 hours ago

    A bit odd to implement the GUI for a background battery health widget in Electron, of all things.

  • diebeforei485 5 hours ago

    I'm not sure if adding another Electron app is good for my system lol.