{"id":50675223,"url":"https://github.com/ziuus/batman","last_synced_at":"2026-06-08T15:03:10.172Z","repository":{"id":298867245,"uuid":"1001379104","full_name":"ziuus/batman","owner":"ziuus","description":" A CLI Battery Manager for Linux (with real conservation mode support)","archived":false,"fork":false,"pushed_at":"2025-11-14T06:13:28.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-14T08:21:35.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ziuus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-13T09:24:49.000Z","updated_at":"2025-11-14T06:13:31.000Z","dependencies_parsed_at":"2025-06-13T10:41:33.365Z","dependency_job_id":"23b17a63-8e8e-4963-8f4a-79da98e63875","html_url":"https://github.com/ziuus/batman","commit_stats":null,"previous_names":["dovndev/batman","zius1414/batman","ziuus/batman"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ziuus/batman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziuus%2Fbatman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziuus%2Fbatman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziuus%2Fbatman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziuus%2Fbatman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziuus","download_url":"https://codeload.github.com/ziuus/batman/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziuus%2Fbatman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34067353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-06-08T15:03:02.706Z","updated_at":"2026-06-08T15:03:10.164Z","avatar_url":"https://github.com/ziuus.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BATMAN — Battery Manager CLI\n\nBATMAN is a minimal, auditable command-line utility to read battery state and toggle Lenovo-style \"conservation\" charging mode via the kernel sysfs interface. The tool is intentionally small, portable, and scriptable so it can be reviewed and packaged easily.\n\n## Motivation\nModern laptops may provide a \"conservation\" mode that limits charging to prolong battery lifespan. BATMAN provides a tiny, transparent interface to:\n- Query battery capacity and charging status\n- Enable/Disable/Toggle conservation mode\n- Be safely included in scripts, packages, and automated workflows\n\n## Features\n- Single-file CLI (`batman`) with no runtime dependencies beyond bash\n- Commands: status, enable/on, disable/off, toggle, interactive, help\n- Environment-variable overrides for sysfs paths (for testing or alternate hardware)\n- CI builds release artifacts (.tar.gz and .deb) and publishes checksums\n\n## Supported hardware\nBATMAN acts on kernel-exposed sysfs files. It's tested on systems that expose:\n- a battery under `/sys/class/power_supply/BAT0/` (capacity, status)\n- a vendor conservation control sysfs node (path configurable)\n\nIf your hardware exposes equivalent sysfs nodes, BATMAN can be used by overriding the default paths via environment variables.\n\n## Quick usage\n\nShow status:\n```bash\nbatman status\n```\n\nEnable conservation mode (may require sudo):\n```bash\nsudo batman enable\n# or\nsudo batman on\n```\n\nDisable conservation mode:\n```bash\nsudo batman disable\n# or\nsudo batman off\n```\n\nToggle mode:\n```bash\nbatman toggle\n```\n\nInteractive menu:\n```bash\nbatman interactive\n```\n\nHelp:\n```bash\nbatman help\n```\n\n## Installation\n\nOption A — Install from release tarball (recommended)\n```bash\n# download the release tarball, verify checksum, extract, then install\ncurl -L -o batman.tar.gz \"https://github.com/\u003cowner\u003e/batman/releases/download/vX.Y.Z/batman-vX.Y.Z.tar.gz\"\nsha256sum batman.tar.gz      # verify with checksums published in Release\ntar -xzf batman.tar.gz\nsudo install -m 0755 batman /usr/local/bin/batman\n```\n\nOption B — Use included installer (developer)\n```bash\n# idempotent, supports --prefix and --no-sudo\n./install.sh --prefix=\"$HOME/.local\"\n```\n\nOption C — Build and create a .deb (CI produces this automatically on releases)\n```bash\n# build a .deb locally (example)\n# see docs/packaging or CI workflow for the exact steps used in releases\n```\n\nNotes\n- Prefer verifying SHA256 checksums before installing binary artifacts.\n- The repo includes an `install.sh` convenience script for local installs.\n\n## Environment overrides (useful for testing)\nTo run BATMAN against alternative or mocked sysfs paths, set one or more environment variables:\n- CONSERVATION_MODE — path to the conservation_mode node\n- BATTERY_CAPACITY — path to battery capacity (default `/sys/class/power_supply/BAT0/capacity`)\n- BATTERY_STATUS — path to battery status (default `/sys/class/power_supply/BAT0/status`)\n\nExample:\n```bash\nCONSERVATION_MODE=/tmp/mock/conservation_mode \\\nBATTERY_CAPACITY=/tmp/mock/capacity \\\nBATTERY_STATUS=/tmp/mock/status \\\n./batman status\n```\n\n## How it works (brief)\n- Reads battery capacity and status from the configured `BATTERY_CAPACITY` and `BATTERY_STATUS` sysfs files.\n- Reads/writes the `CONSERVATION_MODE` sysfs file to enable/disable conservation (writes `1` to enable, `0` to disable).\n- If direct write is not permitted, the script falls back to using `sudo tee` when appropriate (user will be prompted for password).\n\n## Development \u0026 testing\n- Script language: bash (shebang: `#!/usr/bin/env bash`)\n- Linting: run `shellcheck batman`\n- Smoke tests in CI use mocked sysfs files so CI runs on runners without real battery hardware\n- To run the included smoke test locally, run the test script in `tests/` (if present) or set env overrides and run `./batman status`\n\n## CI / Packaging (what the repo provides)\n- GitHub Actions run shellcheck, a mocked smoke test, and package artifacts:\n  - `batman-\u003ctag\u003e.tar.gz`\n  - `batman-\u003ctag\u003e_\u003cver\u003e.deb`\n  - `checksums.sha256`\n- Releases attach artifacts automatically on tag push (see workflow file).\n\n## Troubleshooting\n- \"Path not found\" errors: ensure your battery and vendor sysfs paths exist or use environment variable overrides.\n- Permission denied on writes: use `sudo batman enable` or adjust udev rules if you want non-root access.\n- Unexpected output: run `batman help` and verify the default sysfs variables used.\n\n## Security \u0026 safety notes\n- BATMAN writes to kernel sysfs and can affect charging behavior. Use with care.\n- Do not run arbitrary install scripts from the internet without verifying release checksums.\n- Consider reviewing the `batman` script before installation — it is intentionally small to simplify auditing.\n\n## Contributing\n- Follow the guidelines in `CONTRIBUTING.md`.\n- Keep changes small and test with the included smoke tests.\n- Use `shellcheck` and preserve the simple, auditable design.\n\n## License\n- MIT — see `LICENSE` for the full text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziuus%2Fbatman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziuus%2Fbatman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziuus%2Fbatman/lists"}