{"id":20332352,"url":"https://github.com/zeroby0/charge-limit-linux","last_synced_at":"2025-04-11T21:32:55.754Z","repository":{"id":175198129,"uuid":"327957467","full_name":"zeroby0/charge-limit-linux","owner":"zeroby0","description":"A systemd service to set battery charge threshold on Linux","archived":false,"fork":false,"pushed_at":"2023-07-01T08:04:53.000Z","size":9,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T17:16:25.925Z","etag":null,"topics":["battery","battery-level","battery-life","battery-management-system","charge-limit","linux","systemd"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroby0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-08T16:38:12.000Z","updated_at":"2024-10-08T15:21:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a758398-0e2f-42f1-9a1d-3bec0bba8be2","html_url":"https://github.com/zeroby0/charge-limit-linux","commit_stats":null,"previous_names":["zeroby0/charge-limit-linux"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Fcharge-limit-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Fcharge-limit-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Fcharge-limit-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Fcharge-limit-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroby0","download_url":"https://codeload.github.com/zeroby0/charge-limit-linux/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482877,"owners_count":21111397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["battery","battery-level","battery-life","battery-management-system","charge-limit","linux","systemd"],"created_at":"2024-11-14T20:26:10.339Z","updated_at":"2025-04-11T21:32:55.735Z","avatar_url":"https://github.com/zeroby0.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Charge Limit\n\nStops charging you laptop when it reaches 60% charge. \n\nTo install, run:\n ```bash\n curl -sL \"https://git.io/JWbU9\" | sudo tee /etc/systemd/system/chargelimit.service\n \n\n sudo systemctl start chargelimit # set limit till next system restart\n sudo systemctl enable chargelimit # set limit automatically every time system restarts \n ```\n \n## FAQs\n### Why should I limit my charge?\n\nKeeping your battery's charge between 40% and 60% will improve it's lifespan and capacity.\n\n**Note**: You should disable the limit, and let your battery charge to 100% and then completely discharge once every 4-5 months.\n\n### How do I change the limit?\n\nOpen the `/etc/systemd/system/chargelimit.service` file in a text-editor of your choice, go to line 8, and replace `60` with your preferred value.\nUse `sudo` to open if it says permission denied.\n\n### How do I remove the limit?\n\nTo remove the limit, run:\n```bash\nsudo systemctl stop chargelimit # removes limit till next system restart\nsudo systemctl disable chargelimit # removes limit till you manually turn it back on\n```\n\nYou may also remove the systemd service file if you want to completely uninstall the program:\n```\nsudo rm  /etc/systemd/system/chargelimit.service\n```\n\n### How does it work?\n\nYou can write your preferred charge limit to this file: `/sys/class/power_supply/BAT0/charge_control_end_threshold`, and the kernel stops charging the battery when it's at the limit.\n\nBut the value you write is reset to `100` when your laptop restarts. This program uses `systemd-services` to write the limit to the file every time your computer restarts.\n\n\n[Read more about systemd services](https://www.linode.com/docs/guides/introduction-to-systemctl/)\n\n\n## License\n\nEverything in this repository is released into public domain and is using [Unlicense](https://github.com/zeroby0/charge-limit-linux/blob/main/LICENSE).\n\nThis is one of those one-off repositories that should probably be a gist.\nIf you have any questions or ideas for improvement, feel free to create an issue or a pull request :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroby0%2Fcharge-limit-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroby0%2Fcharge-limit-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroby0%2Fcharge-limit-linux/lists"}